From 278b51e17ee3f8aaec58b4e3d1154e7e00ab96ab Mon Sep 17 00:00:00 2001 From: Ludovic Dubost Date: Sun, 19 May 2019 17:12:14 +0200 Subject: [PATCH] Implement autocomplete link and mediatag --- bower.json | 2 +- customize.dist/ckeditor-config.js | 2 +- www/common/sframe-app-framework.js | 6 +++ www/common/sframe-boot.js | 1 + www/common/sframe-common-outer.js | 3 +- www/filepicker/inner.js | 19 ++++++-- www/pad/autocomplete-page-plugin.js | 74 +++++++++++++++++++++++++++++ www/pad/inner.js | 29 ++++++++--- 8 files changed, 123 insertions(+), 13 deletions(-) create mode 100644 www/pad/autocomplete-page-plugin.js diff --git a/bower.json b/bower.json index 1021dbf62..3043ead7e 100644 --- a/bower.json +++ b/bower.json @@ -21,7 +21,7 @@ "jquery": "~2.1.3", "tweetnacl": "0.12.2", "components-font-awesome": "^4.6.3", - "ckeditor": "4.7.3", + "ckeditor": "4.10.1", "codemirror": "^5.19.0", "requirejs": "2.3.5", "marked": "0.5.0", diff --git a/customize.dist/ckeditor-config.js b/customize.dist/ckeditor-config.js index dc138a558..22c163cb5 100644 --- a/customize.dist/ckeditor-config.js +++ b/customize.dist/ckeditor-config.js @@ -10,7 +10,7 @@ CKEDITOR.editorConfig = function( config ) { // document itself and causes problems when it's sent across the wire and reflected back config.removePlugins= 'resize,elementspath'; config.resize_enabled= false; //bottom-bar - config.extraPlugins= 'autolink,colorbutton,colordialog,font,indentblock,justify,mediatag,print,blockbase64,mathjax'; + config.extraPlugins= 'autolink,colorbutton,colordialog,font,indentblock,justify,mediatag,print,blockbase64,mathjax,autocomplete,textmatch,cryptpadautocomplete'; config.toolbarGroups= [ // {"name":"clipboard","groups":["clipboard","undo"]}, //{"name":"editing","groups":["find","selection"]}, diff --git a/www/common/sframe-app-framework.js b/www/common/sframe-app-framework.js index b905c9ffd..e38850326 100644 --- a/www/common/sframe-app-framework.js +++ b/www/common/sframe-app-framework.js @@ -451,6 +451,12 @@ define([ if (!common.isLoggedIn()) { return; } common.initFilePicker({ onSelect: function (data) { + // Supporting inserting links to documents and not only mediatags + if (data.filters.link === true) { + mediaTagEmbedder(null, data); + return; + } + if (data.type !== 'file') { console.log("Unexpected data type picked " + data.type); return; diff --git a/www/common/sframe-boot.js b/www/common/sframe-boot.js index 43b424624..4370fb7b0 100644 --- a/www/common/sframe-boot.js +++ b/www/common/sframe-boot.js @@ -8,6 +8,7 @@ var afterLoaded = function (req) { req.cfg = req.cfg || {}; if (req.pfx) { + reg.cfg.pfx = pfx; req.cfg.onNodeCreated = function (node /*, config, module, path*/) { node.setAttribute('src', req.pfx + node.getAttribute('src')); }; diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index dc1031a83..0915510fd 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -700,7 +700,8 @@ define([ SFrameChannel: SFrameChannel, Utils: Utils }; - FP.$iframe = $('