I have a need to get a reference to a SPAN with contenteditable = false and be able to replace the entire span.
In IE this is no problem and editor.getSelection() returns correctly but in Chrome no selection is returned
Thanks
I have a need to get a reference to a SPAN with contenteditable = false and be able to replace the entire span.
In IE this is no problem and editor.getSelection() returns correctly but in Chrome no selection is returned
Thanks
CKE4.0.1 - howto get a valid selection on a contenteditable=fals
any ideas anyone please?
I'm experiencing the same
I'm experiencing the same problem. Some more details, this is my text:
I have a plugin that removes blocks like the form block you see above. So it adds a context menu for blocks (div's), with the delete block action.
The point is that in Chrome 26.0.1410.64 m, the console.log inside the context menu listener enlists the correct element (the div.cm11Form). But inside the action (deleteBlockCommand) the start element of the selection is the document's first p (Some test text - 1).
Now the fun part, when I remove contenteditable="false" from the div, everything works as expected.
Can anyone help out. I have the feeling this is a Chrome/Webkit bug, because we are experiencing this in the last few weeks (end of April 2013). We've tried upgrading from CKEditor 4.0 to CKEditor 4.1.1, but this does not fix this. In IE9 all is fine.
Nobody else experiencing this
Nobody else experiencing this?
Same problem here
Selection is ok, but cannot get element from it, getStartElement() or getSelectedElement() returns null
Nothing we can do here since
Nothing we can do here since it's a form of hack, which is dependent on the browser's API, and in this case Chrome has a problem with it. The new Widgets feature, which will be included in 4.2, will help remedy this problem.
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!
Yes, I have the same problem
Yes, I have the same problem. Works perfectly in Firefox. Does not work in Chrome. Does anyone have a workaround?
To workaround problems which
To workaround problems which browsers have with selecting non-editable elements we implemented the Widgets System which uses fake selections. I strongly recommend looking into it if you want to use non-editable elements inside editor.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Widgets versus contentEditable
The first thing I tried was Widgets and it worked to some extent but I found it limiting. For example, I could not figure out how to add attributes to the enclosing element. The documentation is also rather sparse. I will change to Widgets if those shortcomings are addressed.
Well... there are no ready to
Well... there are no ready to use recipes for everything, but the widget API is documented very thoroughly. For example you're most likely referring to the widget wrapper which is an instance of element and therefore has methods like setAttribute. Additionally, API refers in many places to the init property which is a callback executed when widget is instantiated. There's also a ready callback.
Piotrek (Reinmar) Koszuliński
CKEditor JavaScript Developer
--
CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+