From 54ae143aa268b5ce0253752a2a92b2ab22601b42 Mon Sep 17 00:00:00 2001 From: wpxp123456 <2677556700@qq.com> Date: Thu, 17 Dec 2020 16:10:40 +0800 Subject: [PATCH] fix(bug): bug bug fix #222, fix #355 --- src/controllers/constant.js | 4 ++-- src/controllers/handler.js | 13 +++++++++++++ src/controllers/hyperlinkCtrl.js | 4 ++++ src/controllers/luckysheetConfigsetting.js | 3 +++ src/controllers/menuButton.js | 5 +++-- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/controllers/constant.js b/src/controllers/constant.js index dfcabc9c6..bf5780be8 100644 --- a/src/controllers/constant.js +++ b/src/controllers/constant.js @@ -1048,7 +1048,7 @@ function menuToolBar (){ style="user-select: none;">
-
+
@@ -1083,7 +1083,7 @@ function menuToolBar (){ style="user-select: none;">
-
+
diff --git a/src/controllers/handler.js b/src/controllers/handler.js index f3d35de24..98d5885db 100644 --- a/src/controllers/handler.js +++ b/src/controllers/handler.js @@ -5547,6 +5547,19 @@ export default function luckysheetHandler() { } } } + else if($(e.target).closest('#luckysheet-rich-text-editor').length > 0) { + // 阻止默认粘贴 + e.preventDefault(); + + let clipboardData = window.clipboardData; //for IE + if (!clipboardData) { // for chrome + clipboardData = e.originalEvent.clipboardData; + } + let text = clipboardData.getData('text/plain'); + + // 插入 + document.execCommand("insertText", false, text); + } }); //是否允许加载下一页 diff --git a/src/controllers/hyperlinkCtrl.js b/src/controllers/hyperlinkCtrl.js index 99968cfa0..53a35d205 100644 --- a/src/controllers/hyperlinkCtrl.js +++ b/src/controllers/hyperlinkCtrl.js @@ -127,6 +127,10 @@ const hyperlinkCtrl = { let linkTooltip = $("#luckysheet-insertLink-dialog-linkTooltip").val(); if(linkType == 'external'){ + if(!/^http[s]?:\/\//.test(linkAddress)){ + linkAddress = 'https://' + linkAddress; + } + if(!/^http[s]?:\/\/([\w\-\.]+)+[\w-]*([\w\-\.\/\?%&=]+)?$/ig.test(linkAddress)){ tooltip.info('', hyperlinkText.tooltipInfo1); return; diff --git a/src/controllers/luckysheetConfigsetting.js b/src/controllers/luckysheetConfigsetting.js index cb4f48cda..98874bb60 100644 --- a/src/controllers/luckysheetConfigsetting.js +++ b/src/controllers/luckysheetConfigsetting.js @@ -34,6 +34,9 @@ const luckysheetConfigsetting = { defaultColWidth:73, defaultRowHeight:19, + + defaultTextColor: '#000', + defaultCellColor: '#fff', } export default luckysheetConfigsetting; \ No newline at end of file diff --git a/src/controllers/menuButton.js b/src/controllers/menuButton.js index 903734209..3b9c31dc8 100644 --- a/src/controllers/menuButton.js +++ b/src/controllers/menuButton.js @@ -1,5 +1,6 @@ import { selectionCopyShow, selectIsOverlap } from './select'; import { luckyColor, iconfontObjects } from './constant'; +import luckysheetConfigsetting from './luckysheetConfigsetting'; import luckysheetMoreFormat from './moreFormat'; import alternateformat from './alternateformat'; import conditionformat from './conditionformat'; @@ -584,7 +585,7 @@ const menuButton = { togglePaletteLessText: locale_toolbar.collapse, togglePaletteOnly: true, clearText: locale_toolbar.clearText, - color:"#000", + color: luckysheetConfigsetting.defaultTextColor, noColorSelectedText: locale_toolbar.noColorSelectedText, localStorageKey: "spectrum.textcolor" + server.gridKey, palette: [["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"], @@ -716,7 +717,7 @@ const menuButton = { showSelectionPalette: true, maxPaletteSize: 8, maxSelectionSize: 8, - color: "#fff", + color: luckysheetConfigsetting.defaultCellColor, cancelText: locale_button.cancel, chooseText: locale_button.confirm, togglePaletteMoreText: locale_toolbar.customColor,