Ticket #1049 (closed New Feature: fixed)

Opened 7 years ago

Last modified 7 months ago

Uneditable tags

Reported by: jonhg 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

comment:1 Changed 7 years ago by martinkou

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 7 years ago by jonhg

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 7 years ago by fredck

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 7 years ago by jonhg

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 7 years ago by jonhg

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 6 years ago by arczi

  • Keywords Confirmed added

comment:7 Changed 6 years ago by arczi

#2105 has been marked as DUP

comment:8 Changed 6 years ago by arczi

#144 is a DUP of this ticket

comment:9 Changed 5 years ago by jheid

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

comment:10 Changed 7 months ago by Reinmar

  • Status changed from confirmed to closed
  • Resolution set to fixed

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

Note: See TracTickets for help on using tickets.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy