w8tcha / CKEditor-TextSelection-Plugin

The plugin that makes the editor keep it's text-selection when switching between WYSIWYG and Source mode, and scrolls the selection into the viewport.
MIT License
10 stars 7 forks source link

'TypeError: editor is undefined' when manually installing v1.04 #16

Closed skegel13 closed 9 years ago

skegel13 commented 9 years ago

I get a 'TypeError: editor is undefined' error on line 374 when installing version 1.04 manually in version 4.4.6 of CKEditor. The error occurs when trying to leave source mode and go back into wysiwyg mode.

The error appears to be with the code below in the createBookmark method to override the textRange prototype.

if (editor.undoManager) {
    editor.undoManager.lock();
}

The editor variable is undefined. I looked at the calls to createBookmark in the plugin and they pass the editor variable so I am not sure what causes the issue and I don't seem to have the problem with the moveToBookmark method which also gets editor passed in. As a quick fix for now, I just commented out the above code but doing that adds steps to the undo stack which is what I believe the above code is trying to prevent.

w8tcha commented 9 years ago

Are you also using my codemirror plugin? Because in the version there is the wrong call without the editor as parameter

skegel13 commented 9 years ago

I am using CodeMirror. Speaking of that, when I turn on CodeMirror auto format on startup, the text selection plugin does not go to the proper place in the source view. For now I just turned off auto format. Is there a way to make this work?

w8tcha commented 9 years ago

Please Upgrade to CodeMirror Plugin v1.12 this will solve #15 and #16

skegel13 commented 9 years ago

That fixed it the undo and the editor undefined errors. Thank you.