@saltcorn/ckeditor4
Advanced tools
Comparing version 0.1.12 to 0.1.13
95
index.js
@@ -12,13 +12,13 @@ const { | ||
const File = require("@saltcorn/data/models/file"); | ||
const headers = | ||
features?.deep_public_plugin_serve | ||
? [ | ||
const headers = features?.deep_public_plugin_serve | ||
? [ | ||
{ | ||
script: `/plugins/public/ckeditor4${features?.version_plugin_serve_path | ||
? "@" + require("./package.json").version | ||
: "" | ||
}/ckeditor.js`, | ||
script: `/plugins/public/ckeditor4${ | ||
features?.version_plugin_serve_path | ||
? "@" + require("./package.json").version | ||
: "" | ||
}/ckeditor.js`, | ||
}, | ||
] | ||
: [ | ||
: [ | ||
{ | ||
@@ -28,2 +28,3 @@ script: "https://cdn.ckeditor.com/4.16.0/standard/ckeditor.js", | ||
]; | ||
const public_user_role = features?.public_user_role || 10; | ||
@@ -36,3 +37,3 @@ const CKEditor4 = { | ||
configFields: async () => { | ||
const dirs = File.allDirectories ? await File.allDirectories() : null | ||
const dirs = File.allDirectories ? await File.allDirectories() : null; | ||
return [ | ||
@@ -52,11 +53,13 @@ { | ||
}, | ||
...dirs ? [ | ||
{ | ||
name: "folder", | ||
label: "Folder", | ||
type: "String", | ||
attributes: { options: dirs.map(d => d.path_to_serve) } | ||
} | ||
] : [] | ||
] | ||
...(dirs | ||
? [ | ||
{ | ||
name: "folder", | ||
label: "Folder", | ||
type: "String", | ||
attributes: { options: dirs.map((d) => d.path_to_serve) }, | ||
}, | ||
] | ||
: []), | ||
]; | ||
}, | ||
@@ -67,23 +70,23 @@ run: (nm, v, attrs, cls) => { | ||
? [ | ||
{ name: "basicstyles", groups: ["basicstyles", "cleanup"] }, | ||
{ name: "links", groups: ["links"] }, | ||
{ name: "basicstyles", groups: ["basicstyles", "cleanup"] }, | ||
{ name: "links", groups: ["links"] }, | ||
{ name: "insert", groups: ["insert"] }, | ||
{ | ||
name: "paragraph", | ||
groups: [ | ||
"list", | ||
"indent", | ||
"blocks", | ||
"align", | ||
"bidi", | ||
"paragraph", | ||
], | ||
}, | ||
{ name: "insert", groups: ["insert"] }, | ||
{ | ||
name: "paragraph", | ||
groups: [ | ||
"list", | ||
"indent", | ||
"blocks", | ||
"align", | ||
"bidi", | ||
"paragraph", | ||
], | ||
}, | ||
{ name: "colors", groups: ["colors"] }, | ||
{ name: "others", groups: ["others"] }, | ||
] | ||
{ name: "colors", groups: ["colors"] }, | ||
{ name: "others", groups: ["others"] }, | ||
] | ||
: attrs.toolbar === "Document" | ||
? [ | ||
? [ | ||
{ name: "basicstyles", groups: ["basicstyles", "cleanup"] }, | ||
@@ -113,3 +116,3 @@ | ||
] | ||
: [ | ||
: [ | ||
{ name: "basicstyles", groups: ["basicstyles", "cleanup"] }, | ||
@@ -146,4 +149,4 @@ { name: "links", groups: ["links"] }, | ||
: attrs.toolbar === "Document" | ||
? "uploadimage,colorbutton,font,justify,dialogadvtab,colordialog" | ||
: "uploadimage,dialogadvtab"; | ||
? "uploadimage,colorbutton,font,justify,dialogadvtab,colordialog" | ||
: "uploadimage,dialogadvtab"; | ||
return div( | ||
@@ -169,3 +172,7 @@ { | ||
toolbarGroups: ${JSON.stringify(toolbarGroups)}, | ||
${attrs.toolbar === "Document" ? `removeButtons: '',` : `removeButtons: 'Subscript,Superscript',`} | ||
${ | ||
attrs.toolbar === "Document" | ||
? `removeButtons: '',` | ||
: `removeButtons: 'Subscript,Superscript',` | ||
} | ||
disallowedContent: 'img{width,height}', | ||
@@ -191,4 +198,8 @@ extraAllowedContent: 'img[width,height]' | ||
formData.append( 'file', fileLoader.file, fileLoader.fileName ); | ||
formData.append( 'min_role_read',10 ); | ||
${attrs.folder ? `formData.append( 'folder', ${JSON.stringify(attrs.folder)} );` : ''} | ||
formData.append( 'min_role_read',${public_user_role} ); | ||
${ | ||
attrs.folder | ||
? `formData.append( 'folder', ${JSON.stringify(attrs.folder)} );` | ||
: "" | ||
} | ||
xhr.setRequestHeader( 'CSRF-Token', _sc_globalCsrf ); | ||
@@ -195,0 +206,0 @@ xhr.setRequestHeader( 'X-Requested-With', 'XMLHttpRequest' ); |
{ | ||
"name": "@saltcorn/ckeditor4", | ||
"version": "0.1.12", | ||
"version": "0.1.13", | ||
"description": "CKEditor4 editor for HTML fields", | ||
@@ -21,3 +21,19 @@ "main": "index.js", | ||
"test": "jest" | ||
}, | ||
"eslintConfig": { | ||
"extends": "eslint:recommended", | ||
"parserOptions": { | ||
"ecmaVersion": 2020 | ||
}, | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
}, | ||
"rules": { | ||
"no-unused-vars": "off", | ||
"no-case-declarations": "off", | ||
"no-empty": "warn", | ||
"no-fallthrough": "warn" | ||
} | ||
} | ||
} |
3176006
17978