Skip to content

Commit 49ac398

Browse files
committed
Squashed 'libs/editor/' changes from b012dc8..a2a6a7c
a2a6a7c 1.2 version bump 592ea7e Merge pull request #422 from wordpress-mobile/issue/421-clear-failed-videos 8b2453f Merge branch 'develop' into issue/421-clear-failed-videos c5f3e9c Merge pull request #420 from wordpress-mobile/issue/409-cursor-under-media 4851a46 Merge branch 'develop' into issue/409-cursor-under-media 3a88793 Fixed matching for media at the end of posts to work on API18 and below 5850256 Add an empty paragraph after media items at the end of posts when converting from HTML git-subtree-dir: libs/editor git-subtree-split: a2a6a7cf311a1ff5c87dee85625d088c0ceb00b7
1 parent 1cf141b commit 49ac398

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

WordPressEditor/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ android {
2222
buildToolsVersion "23.0.3"
2323

2424
defaultConfig {
25-
versionCode 11
26-
versionName "1.1"
25+
versionCode 12
26+
versionName "1.2"
2727
minSdkVersion 16
2828
targetSdkVersion 23
2929
}

libs/editor-common/assets/editor-utils-formatter.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ Formatter.convertPToDiv = function(html) {
2222
mutatedHTML = mutatedHTML.replace(/(<img [^<>]*>|<\/a>|<\/video>|<\/span>)<br \/>/igm,
2323
function replaceBrWithDivs(match) { return match.substr(0, match.length - 6) + '</div><div>'; });
2424

25+
// Append paragraph-wrapped break tag under media at the end of a post
26+
mutatedHTML = mutatedHTML.replace(/(<img [^<>]*>|<\/a>|<\/video>|<\/span>)[^<>]*<\/div>\s$/igm,
27+
function replaceBrWithDivs(match) { return match + '<div><br></div>'; });
28+
2529
return mutatedHTML;
2630
}
2731

libs/editor-common/assets/test/test-formatter.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function testMediaParagraphWrapping(mediaType, htmlModeMediaHtml, visualModeMedi
5656
assert.equal('<p>' + visualModeMediaHtml + '</p>\n', visualFormattingApplied);
5757

5858
var convertedToDivs = formatter.convertPToDiv(visualFormattingApplied).replace(/\n/g, '');
59-
assert.equal('<div>' + visualModeMediaHtml + '</div>', convertedToDivs);
59+
assert.equal('<div>' + visualModeMediaHtml + '</div><div><br></div>', convertedToDivs);
6060
});
6161

6262
it('with paragraphs above and below', function () {
@@ -106,7 +106,7 @@ function testMediaParagraphWrapping(mediaType, htmlModeMediaHtml, visualModeMedi
106106
assert.equal('<p>Line 1</p>\n<p>' + visualModeMediaHtml + '</p>\n', visualFormattingApplied);
107107

108108
var convertedToDivs = formatter.convertPToDiv(visualFormattingApplied).replace(/\n/g, '');
109-
assert.equal('<div>Line 1</div><div>' + visualModeMediaHtml + '</div>', convertedToDivs);
109+
assert.equal('<div>Line 1</div><div>' + visualModeMediaHtml + '</div><div><br></div>', convertedToDivs);
110110
});
111111

112112
it('end of post, with line break above', function () {
@@ -116,7 +116,7 @@ function testMediaParagraphWrapping(mediaType, htmlModeMediaHtml, visualModeMedi
116116
assert.equal('<p>Line 1<br \/>\n' + visualModeMediaHtml + '</p>\n', visualFormattingApplied);
117117

118118
var convertedToDivs = formatter.convertPToDiv(visualFormattingApplied).replace(/\n/g, '');
119-
assert.equal('<div>Line 1</div><div>' + visualModeMediaHtml + '</div>', convertedToDivs);
119+
assert.equal('<div>Line 1</div><div>' + visualModeMediaHtml + '</div><div><br></div>', convertedToDivs);
120120
});
121121
});
122122
}

0 commit comments

Comments
 (0)