From d759eb4d9dd94690c59bb99e66990860871e63d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Tue, 4 Jun 2019 22:20:27 +0200 Subject: [PATCH] remove toggleSearch command --- .../Routes/SearchAndReplace/index.vue | 102 ++++++++---------- examples/assets/sass/main.scss | 4 + .../src/extensions/Search.js | 19 ---- 3 files changed, 50 insertions(+), 75 deletions(-) diff --git a/examples/Components/Routes/SearchAndReplace/index.vue b/examples/Components/Routes/SearchAndReplace/index.vue index 2cb1f3c26..33296bf6a 100644 --- a/examples/Components/Routes/SearchAndReplace/index.vue +++ b/examples/Components/Routes/SearchAndReplace/index.vue @@ -105,34 +105,25 @@ - - Search -
- - - - - -
-
+ @@ -173,7 +164,7 @@ export default { }, data() { return { - searching: false, + // searching: false, searchTerm: null, replaceWith: null, editor: new Editor({ @@ -199,16 +190,6 @@ export default { new Underline(), new History(), ], - onUpdate: ({ getJSON }) => { - this.json = getJSON() - }, - onToggleSearch: searching => { - this.$nextTick(() => { - if (searching) { - this.$refs.search.focus() - } - }) - }, content: `

Hi there, @@ -240,25 +221,34 @@ export default { } - diff --git a/examples/assets/sass/main.scss b/examples/assets/sass/main.scss index b62f878a7..b88a0b02a 100644 --- a/examples/assets/sass/main.scss +++ b/examples/assets/sass/main.scss @@ -72,6 +72,10 @@ h3 { border-radius: 3px; cursor: pointer; background-color: rgba($color-black, 0.1); + + &:hover { + background-color: rgba($color-black, 0.15); + } } .message { diff --git a/packages/tiptap-extensions/src/extensions/Search.js b/packages/tiptap-extensions/src/extensions/Search.js index dd63d60a3..465ab6532 100644 --- a/packages/tiptap-extensions/src/extensions/Search.js +++ b/packages/tiptap-extensions/src/extensions/Search.js @@ -15,10 +15,6 @@ export default class Search extends Extension { return 'search' } - init() { - this.editor.events.push('toggleSearch') - } - get defaultOptions() { return { autoSelectNext: true, @@ -30,27 +26,12 @@ export default class Search extends Extension { } } - toggleSearch() { - return () => { - this.options.searching = !this.options.searching - this.editor.emit('toggleSearch', this.options.searching) - return true - } - } - - keys() { - return { - 'Mod-f': this.toggleSearch(), - } - } - commands() { return { find: attrs => this.find(attrs), replace: attrs => this.replace(attrs), replaceAll: attrs => this.replaceAll(attrs), clearSearch: () => this.clear(), - toggleSearch: () => this.toggleSearch(), } }