-
-
Notifications
You must be signed in to change notification settings - Fork 135
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
FEATURE: Serious ckeditor inlineMode isInline
#3553
Draft
mhsdesign
wants to merge
4
commits into
8.4
Choose a base branch
from
feature/seriousCkInlineMode
base: 8.4
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
2a0c238
TASK: Deprecated `autoparagraph: false` and rename it to `DisabledAut…
mhsdesign 2c72e4c
FEATURE: Serious ckeditor inlineMode `isInline`
mhsdesign 92e8e04
!!!TASK: Simplify legacy `autoparagraph: false` mode
mhsdesign ecc84ef
TASK: Fix and correct name of test
mhsdesign File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+12.1 KB
.yarn/cache/@ckeditor-ckeditor5-editor-decoupled-patch-4948255868-bdaefd4a0b.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 2 additions & 4 deletions
6
packages/neos-ui-ckeditor5-bindings/src/plugins/disabledAutoparagraphMode.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
patches/@ckeditor-ckeditor5-editor-decoupled-npm-16.0.0-inline-mode.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
|
||
fixes https://github.com/neos/neos-ui/issues/3545 | ||
|
||
diff --git a/src/decouplededitor.js b/src/decouplededitor.js | ||
index 807e531075bdbded8a34a15ddc5fe50370e0fd61..73afd7a95c8d6b9adf16fe48bf4774d0cfade361 100755 | ||
--- a/src/decouplededitor.js | ||
+++ b/src/decouplededitor.js | ||
@@ -64,7 +64,7 @@ export default class DecoupledEditor extends Editor { | ||
* {@link module:editor-balloon/ballooneditor~BalloonEditor.create `BalloonEditor.create()`}. | ||
* @param {module:core/editor/editorconfig~EditorConfig} config The editor configuration. | ||
*/ | ||
- constructor( sourceElementOrData, config ) { | ||
+ constructor( sourceElementOrData, config, isInlineMode ) { | ||
super( config ); | ||
|
||
if ( isElement( sourceElementOrData ) ) { | ||
@@ -74,7 +74,25 @@ export default class DecoupledEditor extends Editor { | ||
|
||
this.data.processor = new HtmlDataProcessor(); | ||
|
||
- this.model.document.createRoot(); | ||
+ if (isInlineMode === false) { | ||
+ this.model.document.createRoot(); | ||
+ } else { | ||
+ // patched ala https://github.com/ckeditor/ckeditor5/issues/762#issuecomment-370762111 | ||
+ | ||
+ // we define paragraph as root instead of $root. This will give us no outer tags out of the box and also disable the splitting | ||
+ this.model.document.createRoot('paragraph'); | ||
+ | ||
+ // it is enforced that the root cannot be splitted, but to make this obvious for other plugins we set isLimit | ||
+ this.on('ready', () => this.model.schema.extend('paragraph', {isLimit: true})); | ||
+ | ||
+ // we redefine enter key to create soft breaks (<br>) instead of new paragraphs | ||
+ this.editing.view.document.on('enter', (evt, data) => { | ||
+ this.execute('shiftEnter'); | ||
+ data.preventDefault(); | ||
+ evt.stop(); | ||
+ this.editing.view.scrollToTheSelection(); | ||
+ }, {priority: 'high'}); | ||
+ } | ||
|
||
const shouldToolbarGroupWhenFull = !this.config.get( 'toolbar.shouldNotGroupWhenFull' ); | ||
const view = new DecoupledEditorUIView( this.locale, this.editing.view, { | ||
@@ -218,9 +236,10 @@ export default class DecoupledEditor extends Editor { | ||
* {@link module:editor-decoupled/decouplededitorui~DecoupledEditorUI#getEditableElement `editor.ui.getEditableElement()`}. | ||
* | ||
* @param {module:core/editor/editorconfig~EditorConfig} [config] The editor configuration. | ||
+ * @param {Boolean} isInlineMode Patched inline mode https://github.com/ckeditor/ckeditor5/issues/762#issuecomment-370762111 | ||
* @returns {Promise} A promise resolved once the editor is ready. The promise resolves with the created editor instance. | ||
*/ | ||
- static create( sourceElementOrData, config = {} ) { | ||
+ static create( sourceElementOrData, config = {}, isInlineMode ) { | ||
return new Promise( resolve => { | ||
const isHTMLElement = isElement( sourceElementOrData ); | ||
|
||
@@ -230,7 +249,7 @@ export default class DecoupledEditor extends Editor { | ||
'editor-wrong-element: This type of editor cannot be initialized inside <textarea> element.', null ); | ||
} | ||
|
||
- const editor = new this( sourceElementOrData, config ); | ||
+ const editor = new this( sourceElementOrData, config, isInlineMode ); | ||
|
||
resolve( | ||
editor.initPlugins() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or decide in fusion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We decided to use the the same naming as in fusion:
block
false.And its allowed to either specify it in the nodeType or via the rendering.
Following logic would apply:
happy cases:
editorOptions: { } | { block: true }
+Neos.Fusion:Editable { } | { block: true }
-><div>{isInlineMode: false}</div>
editorOptions: { }
+Neos.Fusion:Editable { block: false }
-><span>{isInlineMode: true}</span>
editorOptions: { block: false }
+Neos.Fusion:Editable { block: false }
-><span>{isInlineMode: true}</span>
but this would also lead to cases like this:
editorOptions: { block: false }
+Neos.Fusion:Editable { } | { block: true }
-><div>{isInlineMode: true}</div>
editorOptions: { block: true }
+Neos.Fusion:Editable { block: false }
-><span>{isInlineMode: false}</span>
So the the notation of
block: false
will always overrule the one from theNeos.Fusion:Editable
. But the rendering will still be affected viaNeos.Fusion:Editable
(i hope i have no logic error in my equations ^^)