1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-14 05:44:50 +00:00

Fix CodeMirror on fake dom (#3547)

* fix for #3547

see https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty

because of "strict mode" - the `parentNode` property may not be writable and causes an error in `fakedom.js` (appendChild)

to reproduce: install CodeMirror, install "Tools for exploring internals of TW", open a heavy Tiddler like the Control-Panel in edit-mode, toggle preview on, switch to "parse tree" or "widget tree"

* check for tw fakedom
This commit is contained in:
BurningTreeC 2018-11-19 21:56:59 +01:00 committed by Jeremy Ruston
parent eea034c32d
commit b629b1412d

View File

@ -109,7 +109,9 @@ function CodeMirrorEngine(options) {
// Create the CodeMirror instance // Create the CodeMirror instance
this.cm = window.CodeMirror(function(cmDomNode) { this.cm = window.CodeMirror(function(cmDomNode) {
// Note that this is a synchronous callback that is called before the constructor returns // Note that this is a synchronous callback that is called before the constructor returns
if(!self.widget.document.isTiddlyWikiFakeDom) {
self.domNode.appendChild(cmDomNode); self.domNode.appendChild(cmDomNode);
}
},config); },config);
// Set up a change event handler // Set up a change event handler