From ac2f0d9950bd9233e5ad56afc7f5615d5dc33438 Mon Sep 17 00:00:00 2001 From: bordun Date: Thu, 29 Apr 2021 21:03:49 +0200 Subject: [PATCH] tree: add "Show in session" context menu action --- CHANGELOG.md | 1 + src/client/editor/context-menu.js | 25 ++++++++++++++++++++++++- src/client/locales/en.js | 1 + src/client/locales/fr.js | 1 + src/scss/ui/selectarea.scss | 17 +++++++++++++++++ 5 files changed, 44 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bf149e2..fb9b809c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - editor - tree: allow specifying multiple type filters + - tree: add "Show in session" context menu action ## 1.9.2 diff --git a/src/client/editor/context-menu.js b/src/client/editor/context-menu.js index 60f3ac41..8b2156e3 100644 --- a/src/client/editor/context-menu.js +++ b/src/client/editor/context-menu.js @@ -88,12 +88,35 @@ var handleClick = function(event) { }, shortcut: 't' }) + + } else { + actions.push({ - separator: true + label: icon('eye') + ' ' + locales('editor_show_in_session'), + action: ()=>{ + for (let w of editor.selectedWidgets) { + var parent = w + while (parent !== widgetManager) { + if (parent.getProp('type') === 'tab') parent.parent.setValue(parent.parent.children.indexOf(parent), {sync: true, send: true}) + else if (parent.getProp('type') === 'modal') parent.setValue(1, {sync: true, send: true}) + parent = parent.parent + } + w.container.classList.add('editor-blink') + w.container.scrollIntoView({block: 'center'}) + setTimeout(()=>{ + w.container.classList.remove('editor-blink') + }, 800) + } + + } }) } + actions.push({ + separator: true + }) + actions.push({ label: icon('copy') + ' ' + locales('editor_copy'), action: editor.copyWidget.bind(editor), diff --git a/src/client/locales/en.js b/src/client/locales/en.js index fc61a0ef..4e7b68a3 100644 --- a/src/client/locales/en.js +++ b/src/client/locales/en.js @@ -16,6 +16,7 @@ module.exports = { // editor context-menu editor_show_in_tree: 'Show in tree', + editor_show_in_session: 'Show in session', editor_front: 'Bring to front', editor_closer: 'Bring closer', editor_back: 'Send to back', diff --git a/src/client/locales/fr.js b/src/client/locales/fr.js index c1c97bb6..63815921 100644 --- a/src/client/locales/fr.js +++ b/src/client/locales/fr.js @@ -15,6 +15,7 @@ module.exports = { // editor context-menu editor_show_in_tree: 'Voir dans l\'arborescence', + editor_show_in_session: 'Voir dans la session', editor_front: 'Amener devant', editor_closer: 'Amener plus près', editor_back: 'Envoyer à l\'arrière', diff --git a/src/scss/ui/selectarea.scss b/src/scss/ui/selectarea.scss index ff1bd1df..721a3763 100644 --- a/src/scss/ui/selectarea.scss +++ b/src/scss/ui/selectarea.scss @@ -41,3 +41,20 @@ box-shadow: none!important; opacity: 1!important; } + + + +.widget.editing.editor-blink:after, +.modal-container.editing.editor-blink > .popup > .popup-wrapper:after { + display: block!important; + -webkit-mask-image: none; + mask-image: none; + background-color: var(--color-accent); + opacity: 0.5!important; + animation: editor-blink 0.51s steps(3) infinite; +} + +@keyframes editor-blink { + from {--color-accent: var(--color-warning)} + to {--color-accent: transparent} +}