[evolution/wip/mcrha/webkit-jsc-api] e-editor.js: Change how the content is initialized
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/mcrha/webkit-jsc-api] e-editor.js: Change how the content is initialized
- Date: Tue, 5 Nov 2019 17:17:00 +0000 (UTC)
commit 783ca68a48e29026a7c82f0be102d472f66aec5f
Author: Milan Crha <mcrha redhat com>
Date: Tue Nov 5 18:17:41 2019 +0100
e-editor.js: Change how the content is initialized
data/webkit/e-editor.js | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/data/webkit/e-editor.js b/data/webkit/e-editor.js
index ab523c89e0..635b813f1c 100644
--- a/data/webkit/e-editor.js
+++ b/data/webkit/e-editor.js
@@ -1116,11 +1116,26 @@ EvoEditor.SetBodyAttribute = function(name, value)
}
}
-document.onload = function() {
- /* Make sure there is a selection */
- if (!document.getSelection().baseNode) {
- document.getSelection.setPosition(document.body.firstChild ? document.body.firstChild :
document.body, 0);
+EvoEditor.initializeContent = function()
+{
+ if (document.body) {
+ if (!document.body.firstChild) {
+ EvoUndoRedo.Disable();
+ try {
+ document.body.innerHTML = "<div><br></div>";
+ } finally {
+ EvoUndoRedo.Enable();
+ }
+ }
+
+ /* Make sure there is a selection */
+ if (!document.getSelection().baseNode) {
+ document.getSelection().setPosition(document.body.firstChild ?
document.body.firstChild : document.body, 0);
+ }
}
}
+document.onload = EvoEditor.initializeContent;
document.onselectionchange = function() { EvoEditor.maybeUpdateFormattingState(false); };
+
+EvoEditor.initializeContent();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]