From 88d7cb200e2f5a55fe2efc7183b4bbde131bcd8c Mon Sep 17 00:00:00 2001 From: zmagod Date: Wed, 18 Jan 2017 23:06:14 +0100 Subject: [PATCH] removed quill --- app/assets/javascripts/protocols/steps.js.erb | 2 ++ .../javascripts/sitewide/quill_links.js | 22 ------------------- app/assets/javascripts/sitewide/tiny_mce.js | 9 ++------ 3 files changed, 4 insertions(+), 29 deletions(-) delete mode 100644 app/assets/javascripts/sitewide/quill_links.js diff --git a/app/assets/javascripts/protocols/steps.js.erb b/app/assets/javascripts/protocols/steps.js.erb index a15cd0c71..ce7e28b6a 100644 --- a/app/assets/javascripts/protocols/steps.js.erb +++ b/app/assets/javascripts/protocols/steps.js.erb @@ -244,6 +244,7 @@ function formNewAjax($form) { expandStep($new_step); toggleButtons(true); + TinyMCE.init(); //Rerender tables $new_step.find("div.step-result-hot-table").each(function() { $(this).handsontable("render"); @@ -260,6 +261,7 @@ function formNewAjax($form) { formCallback($form); formNewAjax($form); applyCancelOnNew(); + TinyMCE.destroyAll(); }); } diff --git a/app/assets/javascripts/sitewide/quill_links.js b/app/assets/javascripts/sitewide/quill_links.js deleted file mode 100644 index 69282ec8c..000000000 --- a/app/assets/javascripts/sitewide/quill_links.js +++ /dev/null @@ -1,22 +0,0 @@ - - -// Globally overwrite links handling in Quill rich text editor -// var Link = Quill.import('formats/link'); -// Link.sanitize = function(url) { -// if (url.includes('http:') || url.includes('https:')) { -// return url; -// } -// return 'http://' + url; -// }; -// -// function openLinksInNewTab() { -// _.each($('.ql-editor a'), function(el) { -// if ($(el).attr('target') !== '_blank') { -// $(el).attr('target', '_blank'); -// } -// }); -// } -// -// $(document).ready(function(){ -// openLinksInNewTab(); -// }); diff --git a/app/assets/javascripts/sitewide/tiny_mce.js b/app/assets/javascripts/sitewide/tiny_mce.js index 742a37480..42dbe60e9 100644 --- a/app/assets/javascripts/sitewide/tiny_mce.js +++ b/app/assets/javascripts/sitewide/tiny_mce.js @@ -14,14 +14,10 @@ var TinyMCE = (function() { if (typeof tinyMCE != 'undefined') { tinyMCE.init({ selector: "textarea.tinymce", - toolbar: ["undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link | print preview | forecolor backcolor emoticons | codesample"], - plugins: "link,advlist,codesample,autolink,lists,link,charmap,print,preview,hr,anchor,pagebreak,searchreplace,wordcount,visualblocks,visualchars,code,fullscreen,insertdatetime,nonbreaking,save,table,contextmenu,directionality,emoticons,template,paste,textcolor,colorpicker,textpattern,imagetools,toc", + toolbar: ["undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link | print preview | forecolor backcolor | codesample"], + plugins: "link,advlist,codesample,autolink,lists,link,charmap,print,preview,hr,anchor,pagebreak,searchreplace,wordcount,visualblocks,visualchars,code,fullscreen,insertdatetime,nonbreaking,save,table,contextmenu,directionality,paste,textcolor,colorpicker,textpattern,imagetools,toc", codesample_languages: [{"text":"R","value":"r"},{"text":"MATLAB","value":"matlab"},{"text":"Python","value":"python"},{"text":"JSON","value":"javascript"},{"text":"HTML/XML","value":"markup"},{"text":"JavaScript","value":"javascript"},{"text":"CSS","value":"css"},{"text":"PHP","value":"php"},{"text":"Ruby","value":"ruby"},{"text":"Java","value":"java"},{"text":"C","value":"c"},{"text":"C#","value":"csharp"},{"text":"C++","value":"cpp"}], init_instance_callback: function(editor) { - - editor.on('init', function() { - - }); SmartAnnotation.init($(editor.contentDocument.activeElement)); }, setup: function(editor) { @@ -30,7 +26,6 @@ var TinyMCE = (function() { return false; }); } - }); } },