aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/contextMenu.js
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2018-12-01 14:40:23 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2018-12-01 14:40:23 +0100
commitccc50e865d9598ed22f66d8a7cfa86160ba40e6c (patch)
tree47a08a9fff90142114dd1fabd709b8f25b4c64d3 /src/webview/contextMenu.js
parentMove default feature config to config.js (diff)
downloadferdium-app-ccc50e865d9598ed22f66d8a7cfa86160ba40e6c.tar.gz
ferdium-app-ccc50e865d9598ed22f66d8a7cfa86160ba40e6c.tar.zst
ferdium-app-ccc50e865d9598ed22f66d8a7cfa86160ba40e6c.zip
Fix empty 'cut' context menu when no text is selected
Diffstat (limited to 'src/webview/contextMenu.js')
-rw-r--r--src/webview/contextMenu.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/webview/contextMenu.js b/src/webview/contextMenu.js
index 4dda51bde..9b148b220 100644
--- a/src/webview/contextMenu.js
+++ b/src/webview/contextMenu.js
@@ -26,6 +26,8 @@ const buildMenuTpl = (props, suggestions) => {
26 const hasText = props.selectionText.trim().length > 0; 26 const hasText = props.selectionText.trim().length > 0;
27 const can = type => editFlags[`can${type}`] && hasText; 27 const can = type => editFlags[`can${type}`] && hasText;
28 28
29 console.log(props);
30
29 let menuTpl = [ 31 let menuTpl = [
30 { 32 {
31 type: 'separator', 33 type: 'separator',
@@ -33,7 +35,7 @@ const buildMenuTpl = (props, suggestions) => {
33 id: 'cut', 35 id: 'cut',
34 role: can('Cut') ? 'cut' : '', 36 role: can('Cut') ? 'cut' : '',
35 enabled: can('Cut'), 37 enabled: can('Cut'),
36 visible: props.isEditable, 38 visible: props.selectionText.trim(),
37 }, { 39 }, {
38 id: 'copy', 40 id: 'copy',
39 label: 'Copy', 41 label: 'Copy',
@@ -130,6 +132,7 @@ const buildMenuTpl = (props, suggestions) => {
130 }); 132 });
131 } 133 }
132 134
135 console.log('suggestions', suggestions.length, suggestions);
133 if (suggestions.length > 0) { 136 if (suggestions.length > 0) {
134 suggestions.reverse().map(suggestion => menuTpl.unshift({ 137 suggestions.reverse().map(suggestion => menuTpl.unshift({
135 id: `suggestion-${suggestion}`, 138 id: `suggestion-${suggestion}`,