-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] web_editor_class_selector: Migration to 17.0
- Loading branch information
1 parent
24a3055
commit 1a2cab1
Showing
7 changed files
with
53 additions
and
41 deletions.
There are no files selected for viewing
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
8 changes: 4 additions & 4 deletions
8
web_editor_class_selector/static/src/js/odoo-editor/OdooEditor.esm.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
13 changes: 13 additions & 0 deletions
13
web_editor_class_selector/static/src/js/odoo-editor/toolbar.esm.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** @odoo-module */ | ||
|
||
import {Toolbar} from "@web_editor/js/editor/toolbar"; | ||
import {patch} from "@web/core/utils/patch"; | ||
|
||
patch(Toolbar.props, { | ||
...Toolbar.props, | ||
custom_class_css: {type: Array, optional: true}, | ||
}); | ||
patch(Toolbar.defaultProps, { | ||
...Toolbar.defaultProps, | ||
custom_class_css: [], | ||
}); |
30 changes: 11 additions & 19 deletions
30
web_editor_class_selector/static/src/js/wysiwyg/wysiwyg.esm.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,17 @@ | ||
/** @odoo-module **/ | ||
import Wysiwyg from "web_editor.wysiwyg"; | ||
import core from "web.core"; | ||
import {Wysiwyg} from "@web_editor/js/wysiwyg/wysiwyg"; | ||
import {createCustomCssFormats} from "../odoo-editor/utils.esm"; | ||
import {patch} from "@web/core/utils/patch"; | ||
|
||
const Qweb = core.qweb; | ||
|
||
Wysiwyg.include({ | ||
_configureToolbar: function (options) { | ||
this._super(options); | ||
if (options.custom_class_css && options.custom_class_css.length > 0) { | ||
const $dialogContent = $( | ||
Qweb.render("web_editor_class_selector.custom_class_css", { | ||
custom_class_css: options.custom_class_css, | ||
}) | ||
); | ||
$dialogContent.appendTo(this.toolbar.$el); | ||
// Binding the new commands to the editor | ||
// to react to the click on the new options | ||
this.odooEditor.bindExecCommand($dialogContent[0]); | ||
this.odooEditor.custom_class_css = options.custom_class_css; | ||
createCustomCssFormats(options.custom_class_css); | ||
patch(Wysiwyg.prototype, { | ||
_configureToolbar(options) { | ||
super._configureToolbar(options); | ||
if ( | ||
options.toolbarOptions.custom_class_css && | ||
options.toolbarOptions.custom_class_css.length > 0 | ||
) { | ||
this.odooEditor.custom_class_css = options.toolbarOptions.custom_class_css; | ||
createCustomCssFormats(options.toolbarOptions.custom_class_css); | ||
} | ||
}, | ||
}); |
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