Skip to content

Commit e1e425a

Browse files
authored
Merge pull request #427 from wordpress-mobile/add/video-shortcode-for-quick-testing
Use default WordPress video shortcode for quick testing
2 parents 4e597fa + b0e2c1d commit e1e425a

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

aztec/src/main/java/org/wordpress/aztec/Html.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ public Spanned convert() {
225225
reader.setContentHandler(this);
226226
try {
227227
reader.setProperty(Parser.lexicalHandlerProperty, this);
228+
source = source.replaceAll("\\[video([^\\]]*)\\]", "<video$1/>");
228229
reader.parse(new InputSource(new StringReader(source)));
229230
} catch (IOException e) {
230231
// We are reading from a string. There should not be IO problems.

aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecMediaSpan.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ abstract class AztecMediaSpan(context: Context, drawable: Drawable?, override va
8787
canvas.restore()
8888
}
8989

90-
fun getHtml(): String {
90+
open fun getHtml(): String {
9191
val sb = StringBuilder()
9292
sb.append("<")
9393
sb.append(TAG)

aztec/src/main/kotlin/org/wordpress/aztec/spans/AztecVideoSpan.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ class AztecVideoSpan(context: Context, drawable: Drawable?, override var nesting
1919
setOverlay(0, ContextCompat.getDrawable(context, android.R.drawable.ic_media_play), Gravity.CENTER)
2020
}
2121

22+
override fun getHtml(): String {
23+
val sb = StringBuilder()
24+
sb.append(" [")
25+
sb.append(TAG)
26+
sb.append(' ')
27+
28+
attributes.removeAttribute("aztec_id")
29+
30+
sb.append(attributes)
31+
sb.append("] ")
32+
return sb.toString()
33+
}
34+
2235
override fun onClick() {
2336
onVideoTappedListener?.onVideoTapped(attributes)
2437
}

0 commit comments

Comments
 (0)