fnp
/
fnpeditor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6b06b64
)
fix some zero-width space weirdness
author
Jan Szejko
<janek37@gmail.com>
Tue, 28 Feb 2017 15:47:12 +0000
(16:47 +0100)
committer
Jan Szejko
<janek37@gmail.com>
Tue, 28 Feb 2017 15:47:12 +0000
(16:47 +0100)
src/editor/modules/documentCanvas/canvas/canvas.js
patch
|
blob
|
history
src/editor/modules/documentCanvas/canvas/documentElement.js
patch
|
blob
|
history
src/editor/modules/documentCanvas/canvas/keyboard.js
patch
|
blob
|
history
diff --git
a/src/editor/modules/documentCanvas/canvas/canvas.js
b/src/editor/modules/documentCanvas/canvas/canvas.js
index
7ebecc8
..
d7d94a7
100644
(file)
--- a/
src/editor/modules/documentCanvas/canvas/canvas.js
+++ b/
src/editor/modules/documentCanvas/canvas/canvas.js
@@
-274,7
+274,10
@@
$.extend(Canvas.prototype, Backbone.Events, {
if(mutation.target.data === '') {
mutation.target.data = utils.unicode.ZWS;
}
if(mutation.target.data === '') {
mutation.target.data = utils.unicode.ZWS;
}
- else if(mutation.oldValue === utils.unicode.ZWS) {
+ if(mutation.target.data === mutation.oldValue) {
+ return; // shouldn't happen, but better be safe
+ }
+ if(mutation.oldValue === utils.unicode.ZWS) {
mutation.target.data = mutation.target.data.replace(utils.unicode.ZWS, '');
canvas._moveCaretToTextElement(canvas.getDocumentElement(mutation.target), 'end');
}
mutation.target.data = mutation.target.data.replace(utils.unicode.ZWS, '');
canvas._moveCaretToTextElement(canvas.getDocumentElement(mutation.target), 'end');
}
diff --git
a/src/editor/modules/documentCanvas/canvas/documentElement.js
b/src/editor/modules/documentCanvas/canvas/documentElement.js
index
dcf05b2
..
d6d60d3
100644
(file)
--- a/
src/editor/modules/documentCanvas/canvas/documentElement.js
+++ b/
src/editor/modules/documentCanvas/canvas/documentElement.js
@@
-279,7
+279,7
@@
$.extend(DocumentTextElement.prototype, {
if(text === '') {
text = utils.unicode.ZWS;
}
if(text === '') {
text = utils.unicode.ZWS;
}
- if(text !== this.
getText()
) {
+ if(text !== this.
dom.contents()[0].data
) {
this.dom.contents()[0].data = text;
}
},
this.dom.contents()[0].data = text;
}
},
diff --git
a/src/editor/modules/documentCanvas/canvas/keyboard.js
b/src/editor/modules/documentCanvas/canvas/keyboard.js
index
0ad2ff3
..
99201bc
100644
(file)
--- a/
src/editor/modules/documentCanvas/canvas/keyboard.js
+++ b/
src/editor/modules/documentCanvas/canvas/keyboard.js
@@
-247,11
+247,12
@@
var keyEventHandlers = [
element = s.canvas.getNearestTextElement('below', s.element);
}
element = s.canvas.getNearestTextElement('below', s.element);
}
+ e.preventDefault();
+
if(!element) {
return;
}
if(!element) {
return;
}
-
var parent = element.wlxmlNode.parent();
if(element.wlxmlNode.getIndex() === 0 && parent.isContextRoot() && (!parent.is('item') || parent.getIndex() === 0)) {
// Don't even try to do anything at the edge of a context root, except for non-first items
var parent = element.wlxmlNode.parent();
if(element.wlxmlNode.getIndex() === 0 && parent.isContextRoot() && (!parent.is('item') || parent.getIndex() === 0)) {
// Don't even try to do anything at the edge of a context root, except for non-first items
@@
-259,8
+260,6
@@
var keyEventHandlers = [
return;
}
return;
}
- e.preventDefault();
-
s.canvas.wlxmlDocument.transaction(function() {
if(element.wlxmlNode.getIndex() === 0) {
goto = element.wlxmlNode.parent().moveUp();
s.canvas.wlxmlDocument.transaction(function() {
if(element.wlxmlNode.getIndex() === 0) {
goto = element.wlxmlNode.parent().moveUp();