Opened 16 years ago
Closed 16 years ago
#2751 closed Task (fixed)
Write fake object display and replacement logic for CKEditor v3
Reported by: | Martin Kou | Owned by: | Martin Kou |
---|---|---|---|
Priority: | Must have (possibly next milestone) | Milestone: | CKEditor 3.0 |
Component: | General | Version: | |
Keywords: | Confirmed | Cc: |
Description
Artur says he needs it for completing the Flash dialog, I should finish it on Monday by porting it from v2.
Attachments (1)
Change History (11)
comment:1 Changed 16 years ago by
Keywords: | Confirmed added |
---|
comment:2 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 Changed 16 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Oh well, there are still a few things left to do..
- The width and height of placeholders needs to be put into the real objects at restoreElement() and restoreHtml().
- The HTML parser in protectHtml() doesn't take into account of empty tags, and then the tagDepth counter inside is buggy (doesn't affect Flash dialog).
- The default size of the placeholder, 80x80, shouldn't be set as inline styles - inline styles needs to be used as the final size of the real object as in point 1. Instead, it should be set in contents.css.
comment:4 Changed 16 years ago by
How to find fake objects in selection? Do I need to find IMG tag when I want to edit OBJECT or it will be done by API?
var element = rangeRoot.getAscendant( 'img', true ); if ( element && element.someAttribute( '_cke_fakeobject' ) && element.someAttribute( 'object' )) //something like that { element = restoreElement(element ); load(element ) }
comment:5 Changed 16 years ago by
The pseudocode you wrote should work. Basically, to process the fake object in the dialog, you need to:
- Get the placeholder element. You can get the currently selected placeholder element by looking for an <img> tag with with "_cke_protected_html" attribute, or having "_cke_fakeobject" in its class.
- Convert the placeholder element into the real element via CKEDITOR.plugins.fakeobjects.restoreElement().
- Process the real element (e.g. change its URL, change its size, etc.)
- Convert the real element back to a placeholder element and insert it to the editing area.
So basically, the real element should never appear in the WYSIWYG area, it's where the placeholder element belongs to. The real element is only used when you need to process it or you need to get the HTML code output.
comment:6 Changed 16 years ago by
Ok, I've fixed the problems I found this afternoon. Now it should be able to retain and display the Flash plugin's sizes correctly, even after the user resized the placeholder in WYSIWYG mode. It should be possible to further simplify the code in the placeholder plugin, however.
Changed 16 years ago by
Attachment: | 2751.patch added |
---|
comment:7 Changed 16 years ago by
I made a proposal patch. It is easier to check selection with additional attribute (for example _cke_real_element_type).
I added also updateFakeElement() to avoid inserting new object after each edition. We can use _cke_real_element_type in elementspath plugin.
comment:8 Changed 16 years ago by
The proposed patch didn't add _cke_real_element_type in protectHtml() under fakeobjects plugin, but otherwise it's good. I've added that myself, and it will be committed after I've tested the plugin for some more time.
The JavaScript error from IE at pressing OK in the Link and Anchor dialogs seems like a regression bug. CKEDITOR.dialog::restoreSelection() doesn't seem to work for now.
comment:10 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
The system works in the prototype branch now. So this ticket should be closed. Any more issues with the fakeobjects system should be filed as separate tickets.
Fixed with [2845].