-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Presets #135
Comments
Aren't presets simply clones of |
This is possible as well. But having presets as features will allow to compose them and publishing them will be easier. See this building scenario: https://github.com/ckeditor/ckeditor5-design/wiki/Building#integrating-ckeditor-into-another-project Let's say you want CKEditor standard preset and some more packages. You do:
Then you say to the builder that you need the following features: features: [ 'preset-standard/standard', 'media' ]
creator: 'creator-classic/classic' |
I'm smelling the birth of the |
Yes, I thought exactly the same when explaining this to PJ today. I'm not sure though how it could work, because if something is some feature's requirement, then it must be loaded. But perhaps we can handle this differently in presets... The plugin collection would know which features it should not load and it would simply avoid instantiating those. However, since features tell their dependencies by constructors, if you pass strings to All this is possible, but perhaps we won't really need |
Already implemented: https://github.com/ckeditor/ckeditor5-presets |
tl;dr: Presets are features requiring other features and following naming convention
ckeditor5-preset-*/*
.A granularity of CKEditor features will mean that even a basic editor will require plenty of them.
For instance, CKEditor 4's basic preset would translate into something like the following set of features:
(Notes: Feature names passed in format
foo
are resolved tofoo/foo
. By "requiring" I mean a feature which requires other features – many times "foo/foo" is an index feature.)typing
(requringdelete/backspace
)enter
(requiringenter/blockenter
,enter/softenter
)delete
(requiringdelete/forwarddelete
,delete/backwardelete
,delete/forwardworddelete
,delete/backwardworddelete
)clipboard
(requiringclipboard/copy
,clipboard/cut
,clipboard/paste
,clipboard/draganddrop
)bascistyle/bold
andbasicstyle/italic
link
list
(requiringlist/numberedlist
,list/bulletedlist
and more)We can already see that some features are shortcuts to a other features. For example
enter/enter
can be a feature requiring two other featuresenter/blockenter
andenter/softenter
. By requiringenter/enter
(which can also be required asenter
) the developer will enable two features at once.Those "index" features become kind of a presets themselves. The same mechanism can be used by typical presets. So e.g. we could have a feature
ckeditor5-preset/basic
that would require all the features listed above. This method allows to mix multiple presets – i.e.ckeditor5-preset/basic
andckeditor5-preset/media
can be used together.There's one problem with the naming convention that I proposed above – if the developer runs
npm install ckeditor5-preset
, then a hundred packages will be installed, because dependencies of all possible presets will need to be resolved. Therefore, I propose to keep presets in separate packages with names starting withckeditor5-preset-*
– sockeditor5-preset-basic/basic
,ckeditor5-preset-media/media
. This will allow other developers creating their presets and won't affect npm that badly. The only downside are the feature names (preset-basic/basic
), but the same is true in creators (creator-classic/classic
). We can eventually decide thatpreset-basic
is automatically resolved topreset-basic/basic
andcreator-classic
tocreator-classic/classic
.The text was updated successfully, but these errors were encountered: