From 448edbf972031e40326d56338685741b920c7cf8 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 23 Apr 2020 13:52:21 +0200 Subject: [PATCH] lint compliance --- .../src/less2/include/comments.less | 2 +- www/pad/comment.js | 35 +++++++++---------- www/pad/comments.js | 8 ++--- www/pad/inner.js | 1 - 4 files changed, 20 insertions(+), 26 deletions(-) diff --git a/customize.dist/src/less2/include/comments.less b/customize.dist/src/less2/include/comments.less index 3ec5de7f7..b217cdae1 100644 --- a/customize.dist/src/less2/include/comments.less +++ b/customize.dist/src/less2/include/comments.less @@ -16,7 +16,7 @@ .cp-comment-form { - &:not(:last-child) { + &:not(:last-child) { margin-bottom: 10px; } } diff --git a/www/pad/comment.js b/www/pad/comment.js index 7dcd162fb..0adeb14f2 100644 --- a/www/pad/comment.js +++ b/www/pad/comment.js @@ -22,10 +22,6 @@ }, init: function (editor) { var pluginName = 'comment'; - var Messages = CKEDITOR._commentsTranslations; // XXX - var targetWidget; - - var styles = {}; var styleDef = { element: 'comment', @@ -42,7 +38,7 @@ // Register the command. var removeStyle = new CKEDITOR.style(styleDef, { 'uid': '' }); editor.addCommand('comment', { - exec: function (editor, data) { + exec: function (editor) { if (editor.readOnly) { return; } editor.focus(); @@ -120,20 +116,21 @@ // Register the toolbar button. // XXX Uncomment selection, remove on prod, only used for dev - editor.ui.addButton && editor.ui.addButton('UnComment', { - label: 'UNCOMMENT', - command: 'uncomment', - toolbar: 'insert,10' - }); - editor.ui.addButton && editor.ui.addButton('Comment', { - label: 'COMMENT', - command: pluginName, - icon : '/pad/icons/comment.png', - toolbar: 'insert,10' - }); - }, - afterInit: function (editor) { - editor.plugins.comments.removeComment = function () {}; + if (editor.ui.addButton) { + editor.ui.addButton('UnComment', { + label: 'UNCOMMENT', + command: 'uncomment', + toolbar: 'insert,10' + }); + } + if (editor.ui.addButton) { + editor.ui.addButton('Comment', { + label: 'COMMENT', + command: pluginName, + icon : '/pad/icons/comment.png', + toolbar: 'insert,10' + }); + } } }); diff --git a/www/pad/comments.js b/www/pad/comments.js index ea2a65f3a..4c0598272 100644 --- a/www/pad/comments.js +++ b/www/pad/comments.js @@ -104,8 +104,6 @@ define([ Messages.comments_submit ]); - var done = false; - $(submit).click(function (e) { e.stopPropagation(); cb(textarea.value); @@ -414,7 +412,7 @@ sel.forEach(function (el) { Env.$inner.focus(); if (!val) { return; } - if (!editor.getSelection().getSelectedText()) { + if (!Env.editor.getSelection().getSelectedText()) { // text has been deleted by another user while we were typing our comment? return void UI.warn(Messages.error); } @@ -427,7 +425,7 @@ sel.forEach(function (el) { u: myId, t: +new Date(), m: val, - v: canonicalize(editor.getSelection().getSelectedText()) + v: canonicalize(Env.editor.getSelection().getSelectedText()) }] }; updateMetadata(Env); @@ -436,7 +434,7 @@ sel.forEach(function (el) { Env.framework.localChange(); }); - Env.$container.prepend(form).show();; + Env.$container.prepend(form).show(); }; }; diff --git a/www/pad/inner.js b/www/pad/inner.js index 09161cea1..4d2df4339 100644 --- a/www/pad/inner.js +++ b/www/pad/inner.js @@ -486,7 +486,6 @@ define([ var metadataMgr = framework._.sfCommon.getMetadataMgr(); var privateData = metadataMgr.getPrivateData(); - var userData = metadataMgr.getUserData(); var common = framework._.sfCommon; var comments = Comments.create({