mirror of https://github.com/jlelse/teleposter
Fixes and improvements
This commit is contained in:
parent
c93a7ae575
commit
2957a2f250
|
@ -105,12 +105,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
function setContent(content) {
|
function setContent(content) {
|
||||||
reset();
|
$('#summernote').summernote('code', content);
|
||||||
if (content) $('#summernote').summernote('code', content);
|
|
||||||
}
|
|
||||||
|
|
||||||
function reset() {
|
|
||||||
$('#summernote').summernote('reset');
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -6,23 +6,17 @@ import android.util.AttributeSet
|
||||||
import android.webkit.JavascriptInterface
|
import android.webkit.JavascriptInterface
|
||||||
import im.delight.android.webview.AdvancedWebView
|
import im.delight.android.webview.AdvancedWebView
|
||||||
|
|
||||||
class Editor : AdvancedWebView {
|
class Editor @JvmOverloads constructor(
|
||||||
|
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||||
|
) : AdvancedWebView(context, attrs, defStyleAttr) {
|
||||||
private var getCallback: (json: String?) -> Unit? = {}
|
private var getCallback: (json: String?) -> Unit? = {}
|
||||||
|
|
||||||
constructor(context: Context) : super(context) {
|
init {
|
||||||
init()
|
prepare()
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
|
||||||
init()
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) {
|
|
||||||
init()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetJavaScriptEnabled", "AddJavascriptInterface")
|
@SuppressLint("SetJavaScriptEnabled", "AddJavascriptInterface")
|
||||||
private fun init() {
|
fun prepare() {
|
||||||
this.settings.javaScriptEnabled = true
|
this.settings.javaScriptEnabled = true
|
||||||
this.addJavascriptInterface(MyJavaScriptInterface(), "android")
|
this.addJavascriptInterface(MyJavaScriptInterface(), "android")
|
||||||
this.settings.loadWithOverviewMode = true
|
this.settings.loadWithOverviewMode = true
|
||||||
|
@ -33,15 +27,12 @@ class Editor : AdvancedWebView {
|
||||||
|
|
||||||
private inner class MyJavaScriptInterface {
|
private inner class MyJavaScriptInterface {
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
|
@SuppressWarnings("unused")
|
||||||
fun getText(json: String) {
|
fun getText(json: String) {
|
||||||
getCallback(json)
|
getCallback(json)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun reset() {
|
|
||||||
this.loadUrl("javascript:reset();")
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setContent(content: String?) {
|
fun setContent(content: String?) {
|
||||||
this.loadUrl("javascript:setContent('${content?.replace("'", "\\'")}');")
|
this.loadUrl("javascript:setContent('${content?.replace("'", "\\'")}');")
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,17 +15,55 @@ import com.afollestad.materialdialogs.list.listItemsSingleChoice
|
||||||
import im.delight.android.webview.AdvancedWebView
|
import im.delight.android.webview.AdvancedWebView
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
|
class MainActivity : AppCompatActivity() {
|
||||||
private val viewer: Viewer? by lazy {
|
private val viewer: Viewer? by lazy {
|
||||||
findViewById<Viewer?>(R.id.viewer)?.apply {
|
findViewById<Viewer?>(R.id.viewer)?.apply {
|
||||||
setListener(this@MainActivity, this@MainActivity)
|
setListener(this@MainActivity, object : AdvancedWebView.Listener {
|
||||||
|
override fun onPageFinished(url: String?) {
|
||||||
|
viewerPendingPage?.let { viewer?.showPage(it) }
|
||||||
|
viewerPendingPage = null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPageError(errorCode: Int, description: String?, failingUrl: String?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDownloadRequested(url: String?, suggestedFilename: String?, mimeType: String?, contentLength: Long, contentDisposition: String?, userAgent: String?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onExternalPageRequest(url: String?) {
|
||||||
|
AdvancedWebView.Browsers.openUrl(this@MainActivity, url)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPageStarted(url: String?, favicon: Bitmap?) {
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private var viewerPendingPage: TelegraphApi.Page? = null
|
||||||
private val editor: Editor? by lazy {
|
private val editor: Editor? by lazy {
|
||||||
findViewById<Editor?>(R.id.editor)?.apply {
|
findViewById<Editor?>(R.id.editor)?.apply {
|
||||||
setListener(this@MainActivity, this@MainActivity)
|
setListener(this@MainActivity, object : AdvancedWebView.Listener {
|
||||||
|
override fun onPageFinished(url: String?) {
|
||||||
|
editorPendingPage?.let { editor?.setContent(it.content) }
|
||||||
|
editorPendingPage = null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPageError(errorCode: Int, description: String?, failingUrl: String?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDownloadRequested(url: String?, suggestedFilename: String?, mimeType: String?, contentLength: Long, contentDisposition: String?, userAgent: String?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onExternalPageRequest(url: String?) {
|
||||||
|
AdvancedWebView.Browsers.openUrl(this@MainActivity, url)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPageStarted(url: String?, favicon: Bitmap?) {
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private var editorPendingPage: TelegraphApi.Page? = null
|
||||||
|
|
||||||
private var currentPage: TelegraphApi.Page? = null
|
private var currentPage: TelegraphApi.Page? = null
|
||||||
private var editorMode = true
|
private var editorMode = true
|
||||||
|
@ -51,34 +89,43 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadEditor(path: String? = null) {
|
override fun onNewIntent(intent: Intent?) {
|
||||||
runOnUiThread {
|
super.onNewIntent(intent)
|
||||||
editorMode = true
|
if (intent?.action == Intent.ACTION_VIEW) {
|
||||||
canEdit = false
|
val uri = URI.create(intent.dataString)
|
||||||
isEdit = false
|
when (uri.host) {
|
||||||
invalidateOptionsMenu()
|
"telegra.ph", "graph.org" -> loadPage(uri.path)
|
||||||
editor?.visibility = View.VISIBLE
|
"edit.telegra.ph", "edit.graph.org" -> login(uri.toString())
|
||||||
viewer?.visibility = View.GONE
|
|
||||||
currentPage = null
|
|
||||||
// Load
|
|
||||||
if (path != null) TelegraphApi.getPage(accessToken, path, true) { success, page, error ->
|
|
||||||
if (success && page != null) {
|
|
||||||
isEdit = true
|
|
||||||
currentPage = page
|
|
||||||
editor?.setContent(page.content)
|
|
||||||
} else {
|
|
||||||
showError(error)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Reset
|
|
||||||
editor?.reset()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun loadEditor(path: String? = null) {
|
||||||
|
editorMode = true
|
||||||
|
canEdit = false
|
||||||
|
isEdit = false
|
||||||
|
invalidateOptionsMenu()
|
||||||
|
editor?.visibility = View.VISIBLE
|
||||||
|
viewer?.visibility = View.GONE
|
||||||
|
currentPage = null
|
||||||
|
// Load
|
||||||
|
if (path != null) TelegraphApi.getPage(accessToken, path, true) { success, page, error ->
|
||||||
|
if (success && page != null) {
|
||||||
|
isEdit = true
|
||||||
|
currentPage = page
|
||||||
|
editorPendingPage = page
|
||||||
|
editor?.prepare()
|
||||||
|
} else {
|
||||||
|
showError(error)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
editor?.prepare()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun login(authUrl: String) {
|
private fun login(authUrl: String) {
|
||||||
TelegraphApi.login(authUrl) { success, accessToken, account ->
|
TelegraphApi.login(authUrl) { success, accessToken, account ->
|
||||||
if (success && accessToken != null) {
|
if (success && !accessToken.isNullOrEmpty()) {
|
||||||
this.accessToken = accessToken
|
this.accessToken = accessToken
|
||||||
this.authorName = account?.authorName
|
this.authorName = account?.authorName
|
||||||
showMessage(getString(R.string.success), getString(R.string.login_success))
|
showMessage(getString(R.string.success), getString(R.string.login_success))
|
||||||
|
@ -87,38 +134,22 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadPage(path: String) {
|
private fun loadPage(path: String) {
|
||||||
runOnUiThread {
|
editorMode = false
|
||||||
editorMode = false
|
canEdit = false
|
||||||
canEdit = false
|
invalidateOptionsMenu()
|
||||||
invalidateOptionsMenu()
|
viewer?.visibility = View.VISIBLE
|
||||||
viewer?.visibility = View.VISIBLE
|
editor?.visibility = View.GONE
|
||||||
editor?.visibility = View.GONE
|
currentPage = null
|
||||||
currentPage = null
|
// Load
|
||||||
// Load
|
TelegraphApi.getPage(accessToken, path, true) { success, page, error ->
|
||||||
TelegraphApi.getPage(accessToken, path, true) { success, page, error ->
|
if (success && page != null) {
|
||||||
if (success && page != null) showPage(page)
|
canEdit = page.canEdit ?: false
|
||||||
else showError(error)
|
invalidateOptionsMenu()
|
||||||
}
|
currentPage = page
|
||||||
}
|
viewerPendingPage = page
|
||||||
}
|
viewer?.prepare()
|
||||||
|
|
||||||
private fun showPage(page: TelegraphApi.Page?) {
|
|
||||||
runOnUiThread {
|
|
||||||
editorMode = false
|
|
||||||
canEdit = page?.canEdit ?: false
|
|
||||||
invalidateOptionsMenu()
|
|
||||||
viewer?.visibility = View.VISIBLE
|
|
||||||
editor?.visibility = View.GONE
|
|
||||||
currentPage = page
|
|
||||||
viewer?.clearHistory()
|
|
||||||
// Show
|
|
||||||
page?.let {
|
|
||||||
viewer?.setArticleTitle(it.title)
|
|
||||||
viewer?.setAuthor(it.authorName, it.authorUrl)
|
|
||||||
viewer?.setViews(it.views)
|
|
||||||
if (it.content == null) viewer?.setDescription(it.description)
|
|
||||||
else viewer?.setContent(it.content)
|
|
||||||
}
|
}
|
||||||
|
else showError(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,29 +157,11 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
|
||||||
?: getString(R.string.error_desc))
|
?: getString(R.string.error_desc))
|
||||||
|
|
||||||
private fun showMessage(title: String? = null, message: String? = null) {
|
private fun showMessage(title: String? = null, message: String? = null) {
|
||||||
runOnUiThread {
|
MaterialDialog(this@MainActivity)
|
||||||
MaterialDialog(this)
|
.title(text = title ?: "")
|
||||||
.title(text = title ?: "")
|
.message(text = message ?: "")
|
||||||
.message(text = message ?: "")
|
.positiveButton(android.R.string.ok)
|
||||||
.positiveButton(android.R.string.ok)
|
.show()
|
||||||
.show()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPageFinished(url: String?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPageStarted(url: String?, favicon: Bitmap?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPageError(errorCode: Int, description: String?, failingUrl: String?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDownloadRequested(url: String?, suggestedFilename: String?, mimeType: String?, contentLength: Long, contentDisposition: String?, userAgent: String?) {
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onExternalPageRequest(url: String?) {
|
|
||||||
AdvancedWebView.Browsers.openUrl(this, url)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
|
@ -186,11 +199,11 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
|
||||||
}
|
}
|
||||||
R.id.publish -> {
|
R.id.publish -> {
|
||||||
editor?.getText { json ->
|
editor?.getText { json ->
|
||||||
MaterialDialog(this)
|
MaterialDialog(this@MainActivity)
|
||||||
.title(R.string.title_question)
|
.title(R.string.title_question)
|
||||||
.input(hintRes = R.string.title_hint, prefill = currentPage?.title
|
.input(hintRes = R.string.title_hint, prefill = currentPage?.title
|
||||||
?: "", allowEmpty = false) { _, title ->
|
?: "", allowEmpty = false) { _, title ->
|
||||||
MaterialDialog(this)
|
MaterialDialog(this@MainActivity)
|
||||||
.title(R.string.name_question)
|
.title(R.string.name_question)
|
||||||
.input(hintRes = R.string.name_hint, prefill = if (isEdit) currentPage?.authorName
|
.input(hintRes = R.string.name_hint, prefill = if (isEdit) currentPage?.authorName
|
||||||
?: authorName ?: "" else authorName
|
?: authorName ?: "" else authorName
|
||||||
|
@ -199,11 +212,11 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
|
||||||
if (isEdit) TelegraphApi.editPage(accessToken, currentPage?.path
|
if (isEdit) TelegraphApi.editPage(accessToken, currentPage?.path
|
||||||
?: "", authorName = name.toString(), title = title.toString(), content = json
|
?: "", authorName = name.toString(), title = title.toString(), content = json
|
||||||
?: "", returnContent = true) { success, page, error ->
|
?: "", returnContent = true) { success, page, error ->
|
||||||
if (success && page != null) showPage(page)
|
if (success && page != null) loadPage(page.path)
|
||||||
else showError(error)
|
else showError(error)
|
||||||
} else TelegraphApi.createPage(accessToken, content = json
|
} else TelegraphApi.createPage(accessToken, content = json
|
||||||
?: "", title = title.toString(), authorName = name.toString(), returnContent = true) { success, page, error ->
|
?: "", title = title.toString(), authorName = name.toString(), returnContent = true) { success, page, error ->
|
||||||
if (success && page != null) showPage(page)
|
if (success && page != null) loadPage(page.path)
|
||||||
else showError(error)
|
else showError(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,7 +231,7 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
R.id.bookmarks -> {
|
R.id.bookmarks -> {
|
||||||
MaterialDialog(this)
|
MaterialDialog(this@MainActivity)
|
||||||
.title(R.string.bookmarks)
|
.title(R.string.bookmarks)
|
||||||
.positiveButton(R.string.open)
|
.positiveButton(R.string.open)
|
||||||
.negativeButton(android.R.string.cancel)
|
.negativeButton(android.R.string.cancel)
|
||||||
|
@ -229,12 +242,12 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
R.id.delete_bookmark -> {
|
R.id.delete_bookmark -> {
|
||||||
MaterialDialog(this)
|
MaterialDialog(this@MainActivity)
|
||||||
.title(R.string.delete_bookmark)
|
.title(R.string.delete_bookmark)
|
||||||
.positiveButton(R.string.delete)
|
.positiveButton(R.string.delete)
|
||||||
.negativeButton(android.R.string.cancel)
|
.negativeButton(android.R.string.cancel)
|
||||||
.listItemsMultiChoice(items = bookmarks().reversed().map { it.second }) { _, indices, _ ->
|
.listItemsMultiChoice(items = bookmarks().reversed().map { it.second }) { _, indices, _ ->
|
||||||
MaterialDialog(this)
|
MaterialDialog(this@MainActivity)
|
||||||
.title(R.string.delete)
|
.title(R.string.delete)
|
||||||
.message(R.string.delete_question)
|
.message(R.string.delete_question)
|
||||||
.positiveButton(android.R.string.yes)
|
.positiveButton(android.R.string.yes)
|
||||||
|
@ -251,7 +264,7 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
|
||||||
R.id.published -> {
|
R.id.published -> {
|
||||||
TelegraphApi.getPageList(accessToken) { success, pageList, error ->
|
TelegraphApi.getPageList(accessToken) { success, pageList, error ->
|
||||||
if (success && pageList != null && pageList.pages != null) {
|
if (success && pageList != null && pageList.pages != null) {
|
||||||
MaterialDialog(this)
|
MaterialDialog(this@MainActivity)
|
||||||
.title(R.string.published)
|
.title(R.string.published)
|
||||||
.positiveButton(R.string.open)
|
.positiveButton(R.string.open)
|
||||||
.negativeButton(android.R.string.cancel)
|
.negativeButton(android.R.string.cancel)
|
||||||
|
@ -264,7 +277,7 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
R.id.bookmark -> {
|
R.id.bookmark -> {
|
||||||
MaterialDialog(this)
|
MaterialDialog(this@MainActivity)
|
||||||
.title(R.string.title_question)
|
.title(R.string.title_question)
|
||||||
.input(hintRes = R.string.title_hint, prefill = currentPage?.title
|
.input(hintRes = R.string.title_hint, prefill = currentPage?.title
|
||||||
?: "", allowEmpty = false) { _, input ->
|
?: "", allowEmpty = false) { _, input ->
|
||||||
|
@ -289,7 +302,7 @@ class MainActivity : AppCompatActivity(), AdvancedWebView.Listener {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
R.id.login -> {
|
R.id.login -> {
|
||||||
MaterialDialog(this)
|
MaterialDialog(this@MainActivity)
|
||||||
.title(R.string.login)
|
.title(R.string.login)
|
||||||
.message(R.string.login_desc)
|
.message(R.string.login_desc)
|
||||||
.positiveButton(android.R.string.ok)
|
.positiveButton(android.R.string.ok)
|
||||||
|
|
|
@ -4,49 +4,53 @@ import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.webkit.JavascriptInterface
|
||||||
import im.delight.android.webview.AdvancedWebView
|
import im.delight.android.webview.AdvancedWebView
|
||||||
|
|
||||||
class Viewer : AdvancedWebView {
|
class Viewer @JvmOverloads constructor(
|
||||||
|
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
|
||||||
|
) : AdvancedWebView(context, attrs, defStyleAttr) {
|
||||||
|
|
||||||
constructor(context: Context) : super(context) {
|
init {
|
||||||
init()
|
prepare()
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
|
||||||
init()
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) {
|
|
||||||
init()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetJavaScriptEnabled", "AddJavascriptInterface")
|
@SuppressLint("SetJavaScriptEnabled", "AddJavascriptInterface")
|
||||||
private fun init() {
|
fun prepare() {
|
||||||
this.settings.javaScriptEnabled = true
|
settings.javaScriptEnabled = true
|
||||||
this.settings.loadWithOverviewMode = true
|
settings.loadWithOverviewMode = true
|
||||||
this.settings.useWideViewPort = true
|
settings.useWideViewPort = true
|
||||||
overScrollMode = View.OVER_SCROLL_NEVER
|
overScrollMode = View.OVER_SCROLL_NEVER
|
||||||
setMixedContentAllowed(true)
|
setMixedContentAllowed(true)
|
||||||
this.loadDataWithBaseURL("https://telegra.ph", context.assets.open("viewer.html").bufferedReader().readText(), "text/html", "utf-8", null)
|
loadDataWithBaseURL("https://telegra.ph", context.assets.open("viewer.html").bufferedReader().readText(), "text/html", "utf-8", null)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setArticleTitle(title: String) {
|
fun showPage(page: TelegraphApi.Page) {
|
||||||
|
clearHistory()
|
||||||
|
setArticleTitle(page.title)
|
||||||
|
setAuthor(page.authorName, page.authorUrl)
|
||||||
|
setViews(page.views)
|
||||||
|
if (page.content == null) setDescription(page.description)
|
||||||
|
else setContent(page.content)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setArticleTitle(title: String) {
|
||||||
this.loadUrl("javascript:setTitle('$title');")
|
this.loadUrl("javascript:setTitle('$title');")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setAuthor(author: String?, url: String?) {
|
private fun setAuthor(author: String?, url: String?) {
|
||||||
this.loadUrl("javascript:setAuthor('$author','$url');")
|
this.loadUrl("javascript:setAuthor('$author','$url');")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setViews(views: Int) {
|
private fun setViews(views: Int) {
|
||||||
this.loadUrl("javascript:setViews('$views');")
|
this.loadUrl("javascript:setViews('$views');")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setDescription(description: String) {
|
private fun setDescription(description: String) {
|
||||||
this.loadUrl("javascript:setDescription('${description.replace("\n", "<br>")}');")
|
this.loadUrl("javascript:setDescription('${description.replace("\n", "<br>")}');")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setContent(content: String?) {
|
private fun setContent(content: String?) {
|
||||||
this.loadUrl("javascript:setContent('${content?.replace("'", "\\'")}');")
|
this.loadUrl("javascript:setContent('${content?.replace("'", "\\'")}');")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue