I have an application where I need to restrict most users to editing only marked fragments inside the document to avoid the risk of breaking the basic template.
My first inclination was to try using the contenteditable attribute but the main audience is IE and so this approach seems problematic.
Eventually I settled on making the main CKE editor readonly and marking the editable fragments with a class of "editable". This class has a style to indicate to the user they can edit this fragment via special background colour.
When they click inside I am using the following inside the plugin init to identify the fragment bounds and enable the [Edit Fragment] toolbar button.
editor.on('selectionChange', function (evt) {...
OK, so now I can pop the dialog with a texarea with the selection and replace with a CKE editor with a simpler toolbar and a custom button for selecting from a library of fragments.
However, I now seem to have issues invoking the context menu, and a few other things... I can edit the fragment, but it does not have access to the parent styles and anchor destinations etc. When I return the document scrolls to the end unexpectedly...
My question is - is this a valid use of CKE (editor within dialog)? Or should I be trying some other way?
If anyone has experience of solving this type of problem or has suggestions please let me know. If I get this working well I'm happy to add to the plugins library.
PS. Found out the context menus are there behind the dialog! z-index = 100001 vs 100010 - how to change this please?