diff --git a/src/assets/locales/en.json b/src/assets/locales/en.json index 9c094133..2c90a392 100644 --- a/src/assets/locales/en.json +++ b/src/assets/locales/en.json @@ -171,7 +171,7 @@ "workspace": "Workspace View", "options-section-title": "Options", "edit-item": "Edit", - "move-item": "Move To", + "move-item": "Copy or Move", "remove-item": "Remove" }, "context-menus": { @@ -183,7 +183,7 @@ "workspace": "Workspace View", "options-section-title": "Options", "edit-item": "Edit", - "move-item": "Move To", + "move-item": "Copy or Move", "remove-item": "Remove" }, "section": { @@ -213,7 +213,8 @@ "edit-mode-name": "Edit Mode", "edit-mode-subtitle": "You are in Edit Mode", "edit-mode-description": "This means you can make modifications to your config, and preview the results, but until you save, none of your changes will be preserved.", - "save-stage-btn": "Save" + "save-stage-btn": "Save", + "cancel-stage-btn": "Cancel" }, "edit-section": { "edit-tooltip": "Click to Edit, or right-click for more options" diff --git a/src/components/LinkItems/Item.vue b/src/components/LinkItems/Item.vue index 2b6910b7..1a45ad4f 100644 --- a/src/components/LinkItems/Item.vue +++ b/src/components/LinkItems/Item.vue @@ -40,7 +40,9 @@ :id="`context-menu-${id}`" @launchItem="launchItem" @openItemSettings="openItemSettings" + @openMoveItemMenu="openMoveItemMenu" /> + @@ -52,6 +54,7 @@ import Icon from '@/components/LinkItems/ItemIcon.vue'; import ItemOpenMethodIcon from '@/components/LinkItems/ItemOpenMethodIcon'; import StatusIndicator from '@/components/LinkItems/StatusIndicator'; import EditItem from '@/components/InteractiveEditor/EditItem'; +import MoveItemTo from '@/components/InteractiveEditor/MoveItemTo'; import ContextMenu from '@/components/LinkItems/ItemContextMenu'; import StoreKeys from '@/utils/StoreMutations'; import { targetValidator } from '@/utils/ConfigHelpers'; @@ -92,6 +95,7 @@ export default { ItemOpenMethodIcon, StatusIndicator, ContextMenu, + MoveItemTo, EditItem, EditModeIcon, }, @@ -289,6 +293,11 @@ export default { lastUsed[itemId] = new Date().getTime(); localStorage.setItem(localStorageKeys.LAST_USED, JSON.stringify(lastUsed)); }, + openMoveItemMenu() { + this.$modal.show(`${modalNames.MOVE_ITEM_TO}-${this.id}`); + this.$store.commit(StoreKeys.SET_MODAL_OPEN, true); + this.closeContextMenu(); + }, }, mounted() { // If ststus checking is enabled, then check service status diff --git a/src/components/LinkItems/ItemContextMenu.vue b/src/components/LinkItems/ItemContextMenu.vue index dd90064f..702f7469 100644 --- a/src/components/LinkItems/ItemContextMenu.vue +++ b/src/components/LinkItems/ItemContextMenu.vue @@ -33,7 +33,7 @@ {{ $t('menu.edit-item') }} -
  • +
  • {{ $t('menu.move-item') }}
  • @@ -51,7 +51,6 @@ import EditIcon from '@/assets/interface-icons/config-edit-json.svg'; import BinIcon from '@/assets/interface-icons/interactive-editor-remove.svg'; import MoveIcon from '@/assets/interface-icons/interactive-editor-move-to.svg'; - import SameTabOpenIcon from '@/assets/interface-icons/open-current-tab.svg'; import NewTabOpenIcon from '@/assets/interface-icons/open-new-tab.svg'; import IframeOpenIcon from '@/assets/interface-icons/open-iframe.svg'; @@ -90,6 +89,9 @@ export default { openSettings() { this.$emit('openItemSettings'); }, + openMoveMenu() { + this.$emit('openMoveItemMenu'); + }, }, }; diff --git a/src/components/LinkItems/Section.vue b/src/components/LinkItems/Section.vue index 0c8d3457..737a92ff 100644 --- a/src/components/LinkItems/Section.vue +++ b/src/components/LinkItems/Section.vue @@ -16,7 +16,7 @@
    { const makeItemId = (sectionStr, itemStr, index) => { const charSum = sectionStr.split('').map((a) => a.charCodeAt(0)).reduce((x, y) => x + y); const itemTitleStr = itemStr.replace(/\s+/g, '-').replace(/[^a-zA-Z ]/g, '').toLowerCase(); - return `${index}_${charSum}_${itemTitleStr}`; + return `${index}_${charSum}_${itemTitleStr}_${Math.random()}`; }; /* Given an array of sections, apply a unique ID to each item, and return modified array */ @@ -40,6 +40,7 @@ export const applyItemId = (inputSections) => { if (sec.items) { sec.items.forEach((item, itemIdx) => { sections[secIdx].items[itemIdx].id = makeItemId(sec.name, item.title, itemIdx); + // TODO: Check if ID already exists, and if so, modify it }); } });