Skip to content

Commit

Permalink
Merge pull request #14 from techdivision/bugfix/blockstyles
Browse files Browse the repository at this point in the history
Bugfix: Combining Blockstyles
  • Loading branch information
regniets authored Sep 28, 2020
2 parents ced3106 + 2072b2c commit 6c74de8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 19 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ Example: [Configuration/Settings.yaml](Configuration/Settings.yaml)
_Note: Using an empty class (cssClass: null) to unset the value might cause errors during rendering in the backend.
The select boxes of this package contain an "x" button for resetting the value._
_BlockStyles cannot be combined at the moment. Other than InlineStyles, you can only set one blockstyle per block._
Activate the preset for your inline editable NodeType property:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ export default (presetIdentifier, presetConfiguration) =>
init() {
this.editor.model.schema.extend(
'$block',
{ allowAttributes: `blockStyles:${presetIdentifier}`}
{ allowAttributes: `blockStyles-${presetIdentifier}`}
);

// Model configuration
const config = {
model: {
key: `blockStyles:${presetIdentifier}`,
key: `blockStyles-${presetIdentifier}`,
values: Object.keys(presetConfiguration.options),
},
view: {}
Expand All @@ -33,6 +33,6 @@ export default (presetIdentifier, presetConfiguration) =>
// Convert the model to view correctly
this.editor.conversion.attributeToAttribute(config);

this.editor.commands.add(`blockStyles:${presetIdentifier}`, new BlockStyleCommand(this.editor, `blockStyles:${presetIdentifier}`));
this.editor.commands.add(`blockStyles:${presetIdentifier}`, new BlockStyleCommand(this.editor, `blockStyles-${presetIdentifier}`));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ export default (presetIdentifier, presetConfiguration) =>
init() {
this.editor.model.schema.extend(
'$text',
{ allowAttributes: `inlineStyles:${presetIdentifier}` }
{ allowAttributes: `inlineStyles-${presetIdentifier}` }
);

// Model configuration
const config = {
model: {
key: `inlineStyles:${presetIdentifier}`,
key: `inlineStyles-${presetIdentifier}`,
values: Object.keys(presetConfiguration.options),
},
view: {}
Expand All @@ -33,6 +33,6 @@ export default (presetIdentifier, presetConfiguration) =>
// Convert the model to view correctly
this.editor.conversion.attributeToElement(config);

this.editor.commands.add(`inlineStyles:${presetIdentifier}`, new InlineStylesCommand(this.editor, `inlineStyles:${presetIdentifier}`));
this.editor.commands.add(`inlineStyles:${presetIdentifier}`, new InlineStylesCommand(this.editor, `inlineStyles-${presetIdentifier}`));
}
}
20 changes: 10 additions & 10 deletions Resources/Public/JavaScript/CkStyles/Plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Resources/Public/JavaScript/CkStyles/Plugin.js.map

Large diffs are not rendered by default.

0 comments on commit 6c74de8

Please sign in to comment.