Skip to content

Commit

Permalink
Merge pull request #19 from techdivision/bugfix/multipleClasses
Browse files Browse the repository at this point in the history
Fix problems when using multiple classes
  • Loading branch information
SimonPaidla authored May 18, 2021
2 parents 3d5be4b + 45ae2b0 commit 115155b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Example: [Configuration/Settings.yaml](Configuration/Settings.yaml)
**What values are allowed for cssClass?**
- **Not null** 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.
- **No whitespace** Using multiple classes seperated by whitespaces (e.g. cssClass: 'btn btn-primary') causes problems when the saved text gets loaded (classes are removed).
- You can add **multiple classes** by separating them with a whitespace. e.g. "btn btn-primary"
**Activate the preset for your inline editable NodeType property:**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ export default (presetIdentifier, presetConfiguration) =>

// View configuration
Object.keys(presetConfiguration.options).forEach(optionIdentifier => {

const classes = presetConfiguration.options[optionIdentifier].cssClass.split(' ');

config.view[optionIdentifier] = {
key: 'class',
value: presetConfiguration.options[optionIdentifier].cssClass
value: classes
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default (presetIdentifier, presetConfiguration) =>
class InlineStylesEditing extends Plugin {
init() {
this.editor.model.schema.extend(
'$text',
'$text',
{ allowAttributes: `inlineStyles-${presetIdentifier}` }
);

Expand All @@ -24,9 +24,12 @@ export default (presetIdentifier, presetConfiguration) =>

// View configuration
Object.keys(presetConfiguration.options).forEach(optionIdentifier => {

const classes = presetConfiguration.options[optionIdentifier].cssClass.split(' ');

config.view[optionIdentifier] = {
name: 'span',
classes: presetConfiguration.options[optionIdentifier].cssClass
classes: classes
}
});

Expand Down
10 changes: 8 additions & 2 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 115155b

Please sign in to comment.