Opened 16 years ago

Closed 9 years ago

#1049 closed New Feature (fixed)

Uneditable tags

Reported by: Jon Håvard Gundersen Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:


It would have been nice if I could have specified tags that are visible but not editable. Whenever a user places the cursor inside these tags the cursor will move outside the element.

For example we are using the symbol font for special characters that are not available as entities. These symbols are placed in the text inside <var> tags. But since this tags are editable the user could experience that he is writing with the symbol font instead of the normal font if he gets the cursor inside a <var> tag.

This also leads to problems with a lot of nested <var> tags if the user inserts a lot of special characters with the dialog popup. All these problems could have been solved by adding an option to the config, ie (FCKConfig.LockedTags = "VAR|SYM")

I realise that it is not recommended to use the symbol font, but I'm afraid our customer demands the characters found here. If you reject this task I would appreciate if you could give me a hint on how to solve this one :)

Change History (10)

comment:1 Changed 16 years ago by Martin Kou

If you look at _samples/html/sample06.html, you'll find there's a placeholder feature that inserts non-editable <span> tags into the document, which should be similar to what you want. I believe it does that by setting the contentEditable attribute of the <span> tag to false. So if you want to do a quick fix yourself, you can try setting contentEditable to false in your <var> tags.

For a proper fix, I think it would be more sensible if we make this into a plugin, since the feature isn't something that everybody needs. Still, it should be quite useful.

comment:2 Changed 16 years ago by Jon Håvard Gundersen

Ah, yes contentEditable seems to do the trick for now. The symbol is now treated as a control object instead of a text range and thats pretty cool.

Thanks for the hint, and I agree with you that this functionality should be implemented as a plugin.

comment:3 Changed 16 years ago by Frederico Caldeira Knabben

The main problem here is making this feature cross browser compatible as contentEditable is a IE only feature. For the Placeholder plugin, for example, it is quite easy to move the caret inside an "uneditable" <span> and change its value.

comment:4 Changed 16 years ago by Jon Håvard Gundersen

Yes, that is true. The correct solution is probably to make a function that denies the cursor to be positioned inside tag specified by a list of given tag names. Should such a function be added to the onmouseup/onkeydown event in editingarea?

I do not like to depend on / trust IE, but as a quick solution until this feature is made the contentEditable attribute seems to be ok.

comment:5 Changed 16 years ago by Jon Håvard Gundersen

Note for the future:

I found out that FCKEnterKey._RecreateEndingTree also needed to be adjusted to prevent an empty uneditable tags beeing created after a enterkey press. :)

comment:6 Changed 15 years ago by Artur Formella

Keywords: Confirmed added

comment:7 Changed 15 years ago by Artur Formella

#2105 has been marked as DUP

comment:8 Changed 15 years ago by Artur Formella

#144 is a DUP of this ticket

comment:9 Changed 14 years ago by jheid

What about a <input type="text" readonly> or a styled <button onclick="return false">...</button>?

comment:10 Changed 9 years ago by Piotrek Koszuliński

Resolution: fixed
Status: confirmedclosed

Since CKEditor 4.3 such use cases can be solved using the Widgets system.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy