@saltcorn/ckeditor4
Advanced tools
Comparing version 0.2.1 to 0.2.2
60
index.js
@@ -50,2 +50,19 @@ const { | ||
}, | ||
{ | ||
name: "autogrow", | ||
label: "Auto-grow", | ||
type: "Bool", | ||
}, | ||
{ | ||
name: "minheight", | ||
label: "Min height (px)", | ||
type: "Integer", | ||
showIf: { autogrow: true }, | ||
}, | ||
{ | ||
name: "maxheight", | ||
label: "Max height (px)", | ||
type: "Integer", | ||
showIf: { autogrow: true }, | ||
}, | ||
...(dirs | ||
@@ -57,3 +74,5 @@ ? [ | ||
type: "String", | ||
attributes: { options: dirs.map((d) => d.path_to_serve) }, | ||
attributes: { | ||
options: [...dirs.map((d) => d.path_to_serve), "Base64 encode"], | ||
}, | ||
}, | ||
@@ -141,8 +160,11 @@ ] | ||
]; | ||
let varPlugin = | ||
attrs.folder === "Base64 encode" ? "base64image" : "uploadimage"; | ||
if (attrs.autogrow) varPlugin += ",autogrow"; | ||
const extraPlugins = | ||
attrs.reduced || attrs.toolbar === "Reduced" | ||
? "uploadimage,dialogadvtab" | ||
? `${varPlugin},dialogadvtab` | ||
: attrs.toolbar === "Document" | ||
? "uploadimage,colorbutton,font,justify,dialogadvtab,colordialog" | ||
: "uploadimage,dialogadvtab"; | ||
? `${varPlugin},colorbutton,font,justify,dialogadvtab,colordialog` | ||
: `${varPlugin},dialogadvtab`; | ||
const rndcls = `cke${Math.floor(Math.random() * 16777215).toString(16)}`; | ||
@@ -167,5 +189,4 @@ | ||
extraPlugins: ${JSON.stringify(extraPlugins)}, | ||
imageUploadUrl: '/files/upload', | ||
${attrs.folder === "Base64 encode" ? "" : `imageUploadUrl: '/files/upload',`} | ||
${attrs.disabled ? `readOnly: true,` : ``} | ||
height: "${attrs.height || 10}em", | ||
toolbarGroups: ${JSON.stringify(toolbarGroups)}, | ||
@@ -177,2 +198,8 @@ ${ | ||
} | ||
${ | ||
attrs.autogrow | ||
? `autoGrow_minHeight: ${attrs.minheight}, | ||
autoGrow_maxHeight:${attrs.maxheight},` | ||
: `height: "${attrs.height || 10}em",` | ||
} | ||
disallowedContent: 'img{width,height}', | ||
@@ -190,4 +217,11 @@ extraAllowedContent: 'img[width,height]' | ||
}); | ||
editor.on( 'fileUploadRequest', function( evt ) { | ||
let ckOnChange = ()=>{ | ||
editor.updateElement(); | ||
$('textarea#input${text(nm)}').closest('form').trigger('change'); | ||
} | ||
editor.on('change', $.debounce ? $.debounce(ckOnChange, 500, null,true) : ckOnChange); | ||
${ | ||
attrs.folder === "Base64 encode" | ||
? "" | ||
: `editor.on( 'fileUploadRequest', function( evt ) { | ||
var fileLoader = evt.data.fileLoader, | ||
@@ -212,7 +246,2 @@ formData = new FormData(), | ||
}) | ||
let ckOnChange = ()=>{ | ||
editor.updateElement(); | ||
$('textarea#input${text(nm)}').closest('form').trigger('change'); | ||
} | ||
editor.on('change', $.debounce ? $.debounce(ckOnChange, 500, null,true) : ckOnChange); | ||
editor.on('fileUploadResponse', function( evt ) { | ||
@@ -228,3 +257,6 @@ evt.stop(); | ||
evt.data.url=r.success.url; | ||
}); | ||
});` | ||
} | ||
$('#input${text(nm)}').on('set_form_field', (e)=>{ | ||
@@ -231,0 +263,0 @@ editor.setData(e.target.value) |
{ | ||
"name": "@saltcorn/ckeditor4", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "CKEditor4 editor for HTML fields", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Copyleft License
License(Experimental) Copyleft license information was found
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found
Found 1 instance in 1 package
3306046
642
19434
6
70