mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[FIX] web_widget_ckeditor: ir.config_parameter read permissions
(+) some small linter warning fixes
This commit is contained in:
committed by
Justine Doutreloux
parent
40c7f7a728
commit
0c871301bd
@@ -17,15 +17,14 @@ odoo.define("web_widget_ckeditor.field_ckeditor", function (require) {
|
||||
const TranslatableFieldMixin = basic_fields.TranslatableFieldMixin;
|
||||
|
||||
// Load configuration for the editor
|
||||
const defaultCKEditorToolbarPromise = rpc.query({
|
||||
const getCKEditorConfigPromise = rpc.query({
|
||||
model: "ir.config_parameter",
|
||||
method: "get_param",
|
||||
args: ["web_widget_ckeditor.toolbar"],
|
||||
method: "get_web_widget_ckeditor_config",
|
||||
});
|
||||
|
||||
// Load CKEditor localization files
|
||||
async function loadCKEditorLanguageSource(languageCode) {
|
||||
if (languageCode == "en") {
|
||||
if (languageCode === "en") {
|
||||
return;
|
||||
}
|
||||
const languageURL = `/web_widget_ckeditor/static/lib/ckeditor/build/translations/${languageCode}.js`;
|
||||
@@ -87,9 +86,10 @@ odoo.define("web_widget_ckeditor.field_ckeditor", function (require) {
|
||||
* @override
|
||||
*/
|
||||
isSet: function () {
|
||||
var value =
|
||||
// Removing spaces & html spaces
|
||||
const value =
|
||||
this.value &&
|
||||
this.value.split(" ").join("").replace(/\s/g, ""); // Removing spaces & html spaces
|
||||
this.value.split(" ").join("").replace(/\s/g, "");
|
||||
return (
|
||||
value &&
|
||||
value !== "<p></p>" &&
|
||||
@@ -143,9 +143,9 @@ odoo.define("web_widget_ckeditor.field_ckeditor", function (require) {
|
||||
*/
|
||||
_getCKEditorToolbarItems: async function () {
|
||||
try {
|
||||
const toolbarConfig = await defaultCKEditorToolbarPromise;
|
||||
if (toolbarConfig) {
|
||||
return toolbarConfig.split(/[\s,]+/).filter((item) => item);
|
||||
const ckconfig = await getCKEditorConfigPromise;
|
||||
if (ckconfig.toolbar) {
|
||||
return ckconfig.toolbar.split(/[\s,]+/).filter((item) => item);
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(
|
||||
|
||||
Reference in New Issue
Block a user