Opened 15 years ago
Closed 15 years ago
#3580 closed Bug (fixed)
IE: switching to Source in Ajax example raises an error
Reported by: | Alfonso Martínez de Lizarrondo | Owned by: | Martin Kou |
---|---|---|---|
Priority: | Must have (possibly next milestone) | Milestone: | CKEditor 3.0 |
Component: | Core : Undo & Redo | Version: | SVN (CKEditor) - OLD |
Keywords: | IE Confirmed Review+ | Cc: |
Description
Load the Ajax sample in IE, switch to source mode and it raises an error.
The Image() method of the undo system is called twice and the second time editor.getSnapshot() returns false.
Attachments (3)
Change History (14)
comment:1 Changed 15 years ago by
Keywords: | Confirmed added |
---|---|
Milestone: | → CKEditor 3.0 |
Priority: | Normal → High |
comment:2 Changed 15 years ago by
Owner: | set to Martin Kou |
---|---|
Status: | new → assigned |
comment:3 Changed 15 years ago by
Keywords: | Review? added |
---|
Changed 15 years ago by
Attachment: | 3580.patch added |
---|
comment:4 follow-up: 6 Changed 15 years ago by
Keywords: | Review- added; Review? removed |
---|
comment:5 Changed 15 years ago by
Hmm... actually the undo systems seems broken in respect to editor mode changes. With the trunk, even if I've set canUndo to false - after switch to Source and back, I would have about 4 undo steps in the system. Some of them even have an extra empty paragraph before the first paragraph.
comment:6 Changed 15 years ago by
Saving snapshot before Source could make sense - this should be checked. Saving snapshot in other dialog aren't connected with the main issue - moved to #3621
Changed 15 years ago by
Attachment: | 3580_2.patch added |
---|
comment:7 Changed 15 years ago by
Keywords: | Review? added; Review- removed |
---|
It makes sense to save an undo snapshot when switching from Source to WYSIWYG mode - the document contents might have changed during Source mode. So if we just set canUndo = false the result would be wrong.
However, because editor.getSnapshot() might return null right after the Source command is executed, it doesn't make sense to save a snapshot right after Source command is invoked.
So, instead of saving snapshot at Source command invocation - we can save the snapshot whenever the editor mode has switched to WYSIWYG. This avoids the null error while still manages to save a snapshot if editor content is changed in Source mode.
comment:8 Changed 15 years ago by
Keywords: | Review- added; Review? removed |
---|
Image is saved only when switching back to WYSIWYG so some undo information are lost.
I found one bug with this patch - steps to reproduce:
-Click "Create Editor"
-Write aaaaaa
-Go to Source mode
-Write bbbbbb
-Back to WYSIWYG
-Click Undo
Result: Editor is empty.
Expected result: aaaaaa in the editor.
To save image why not just add
if ( editor.mode == 'wysiwyg' ) editor.fire( 'saveSnapshot' );
in source.exec() before setMode(...)
Changed 15 years ago by
Attachment: | 3580_3.patch added |
---|
comment:9 Changed 15 years ago by
Keywords: | Review? added; Review- removed |
---|
comment:10 Changed 15 years ago by
Keywords: | Review+ added; Review? removed |
---|
comment:11 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed with [3599].
Click here for more info about our SVN system.
A more simple fix would be found, as now we're saving snapshot for many commands which doesn't make sense for supporting undo, these are:
We should give them a canUndo = false instead of introducing other specific flag.