diff --git a/package.json b/package.json index b4f2af68aabad292feb26d672872af4f0fdeea3e..571ac51f5b1fef6f92e03a9e558e6d318ece2cde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "c-tool", - "version": "1.6.3", + "version": "1.6.4", "private": true, "scripts": { "serve": "vue-cli-service serve --port 8081", diff --git a/src/tool.vue b/src/tool.vue index f6323efc6fc2a1f60c3d2eba9470963b08394f06..dd7081072101657d07b793af2f5d8bc0dd43130f 100644 --- a/src/tool.vue +++ b/src/tool.vue @@ -58,7 +58,7 @@ - + diff --git a/src/tool/config.js b/src/tool/config.js index 58a70b65427f65dc7b39eb16da0f2fc0fe9e581c..44f696c87b9515d6c33f1463e2eecc56e80acda8 100644 --- a/src/tool/config.js +++ b/src/tool/config.js @@ -55,15 +55,26 @@ const getToolDefaultCategory = function (name) { return '' } +/** + * @param name + * @param defaultValue + * @return {any} + */ const getSetting = function (name, defaultValue = null) { let setting = cache.getNoVersion('setting', {}) return !setting.hasOwnProperty(name) ? defaultValue : setting[name] } +/** + * @param name + * @param value + * @return {boolean} + */ const saveSetting = function (name, value) { let setting = cache.getNoVersion('setting', {}) setting[name] = value cache.setNoVersion('setting', setting); + return true } export default { diff --git a/src/tool/model.js b/src/tool/model.js index 427ceb137041f83d7f6a3c788b3f909508d3a1cf..d66bc7b2bf7bb28ae0c6f474321423fc2f712ac7 100644 --- a/src/tool/model.js +++ b/src/tool/model.js @@ -65,6 +65,9 @@ export const plugin = { } else if (setting.autoReadCopy()) { let paste = clipboardPaste() if (!data[clipboardField] && paste) { + if (setting.autoReadCopyFilter()){ + paste = paste.trim() + } data[clipboardField] = paste } } diff --git a/src/tool/setting.js b/src/tool/setting.js index c2313cd93ca9e5b8862fa1fa97e50ab6fb91b05c..d02fcefc00c24969c53b92c24fff0a39a492e8b7 100644 --- a/src/tool/setting.js +++ b/src/tool/setting.js @@ -1,16 +1,35 @@ import config from './config' export default { + /** + * @param value + * @return {boolean} + */ autoSaveCopy (value = null) { if (value === null) { return config.getSetting('auto_save_copy', true) } return config.saveSetting('auto_save_copy', value) }, + + /** + * @param value + * @return {boolean} + */ autoReadCopy (value = null) { if (value === null) { return config.getSetting('auto_read_copy', true) } return config.saveSetting('auto_read_copy', value) }, + /** + * @param value + * @return {boolean} + */ + autoReadCopyFilter (value = null) { + if (value === null) { + return config.getSetting('auto_read_copy_filter', false) + } + return config.saveSetting('auto_read_copy_filter', value) + }, } \ No newline at end of file diff --git a/src/views/setting/block.vue b/src/views/setting/block.vue index 8b03abe88f003358cfdab31a0de700c515405dd4..5ebc02e3c30a3dbb3b423cc3ec84a09c304b4d83 100644 --- a/src/views/setting/block.vue +++ b/src/views/setting/block.vue @@ -12,6 +12,9 @@ + + + @@ -34,6 +37,7 @@ export default { settingShow: false, auto_save_copy: true, auto_read_copy: true, + auto_read_copy_filter: false, is_chrome: isChrome, is_utools: isUtools, } @@ -41,10 +45,12 @@ export default { created() { this.auto_save_copy = setting.autoSaveCopy() this.auto_read_copy = setting.autoReadCopy() + this.auto_read_copy_filter = setting.autoReadCopyFilter() }, beforeDestroy() { setting.autoSaveCopy(this.auto_save_copy) setting.autoReadCopy(this.auto_read_copy) + setting.autoReadCopyFilter(this.auto_read_copy_filter) }, methods: { open(name) {