Opened 17 years ago
Closed 11 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: |
Description
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 17 years ago by
comment:2 Changed 17 years ago by
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 17 years ago by
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 17 years ago by
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 17 years ago by
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 16 years ago by
Keywords: | Confirmed added |
---|
comment:9 Changed 15 years ago by
What about a <input type="text" readonly> or a styled <button onclick="return false">...</button>?
comment:10 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | confirmed → closed |
Since CKEditor 4.3 such use cases can be solved using the Widgets system.
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.