API to get dialog's subject of change / model #2423
Labels
changelog:api
A changelog entry should be put in the API section of the changelog.
plugin:dialog
The plugin which probably causes the issue.
status:confirmed
An issue confirmed by the development team.
target:major
Any docs related issue that should be merged into a major branch.
type:feature
A feature request.
Milestone
Are you reporting a feature request or a bug?
Feature request
Provide detailed reproduction steps (if any)
Currently there's no common way to access a subject of change for a dialog, instead each dialog implements this in a custom way.
Having this unified would allow us to add a method like
dialog.isEditing()
that tells whether a new entity is currently created or an existing one is created. We often need this kind of information.Note that since the dialogs are static,
isEditing
method would need to accepteditor
instance as an argument.Proposal
Add a new interface that might be implemented in dialogDefinition, let's call it
ModeledDialog
.It features a single method:
getModel( editor ) : [Object/null]
table
/link
it would simply return aCKEDITOR.dom.element
if there's a related element to it. For widget plugins (image2
,placeholder
) it would return widget instance that is a subject of this dialog.null
if there's no related model (about
,help
dialogs).If the dialog does not implement
getModel()
it is assumed to be always in editing mode (backward compatible).Compatibility
Compatibility is a priority here. In case we have some workarounds in published plugins, like:
CKEDITOR.dialog.definition.uiElement#setup()
method.The text was updated successfully, but these errors were encountered: