import FieldArea from './area'
-import ContextMenu from './context_menu'
+import FieldContextMenu from './field_context_menu'
+import SelectionContextMenu from './selection_context_menu'
+import PageContextMenu from './page_context_menu'
import SelectionBox from './selection_box'
export default {
name: 'TemplatePage',
components: {
FieldArea,
- ContextMenu,
+ FieldContextMenu,
+ SelectionContextMenu,
+ PageContextMenu,
SelectionBox
},
- inject: ['fieldTypes', 'defaultDrawFieldType', 'fieldsDragFieldRef', 'customDragFieldRef', 'assignDropAreaSize', 'selectedAreasRef', 'template', 'isSelectModeRef'],
+ inject: ['fieldTypes', 'defaultDrawFieldType', 'fieldsDragFieldRef', 'customDragFieldRef', 'assignDropAreaSize', 'selectedAreasRef', 'template', 'isSelectModeRef', 'save'],
props: {
image: {
type: Object,
@@ -140,6 +155,11 @@ export default {
required: false,
default: null
},
+ isMobile: {
+ type: Boolean,
+ required: false,
+ default: false
+ },
withSignatureId: {
type: Boolean,
required: false,
@@ -228,7 +248,7 @@ export default {
default: false
}
},
- emits: ['draw', 'drop-field', 'remove-area', 'copy-field', 'paste-field', 'scroll-to', 'copy-selected-areas', 'delete-selected-areas', 'align-selected-areas', 'autodetect-fields', 'add-custom-field'],
+ emits: ['draw', 'drop-field', 'remove-area', 'copy-field', 'paste-field', 'scroll-to', 'copy-selected-areas', 'delete-selected-areas', 'autodetect-fields', 'add-custom-field', 'set-draw'],
data () {
return {
areaRefs: [],
@@ -305,11 +325,6 @@ export default {
return 'text'
}
},
- isMobile () {
- const isMobileSafariIos = 'ontouchstart' in window && navigator.maxTouchPoints > 0 && /AppleWebKit/i.test(navigator.userAgent)
-
- return isMobileSafariIos || /android|iphone|ipad/i.test(navigator.userAgent)
- },
resizeDirectionClasses () {
return {
nwse: 'cursor-nwse-resize',
@@ -419,10 +434,6 @@ export default {
this.$emit('delete-selected-areas')
this.closeSelectionContextMenu()
},
- handleSelectionAlign (direction) {
- this.$emit('align-selected-areas', direction)
- this.closeSelectionContextMenu()
- },
closeContextMenu () {
this.contextMenu = null
this.newAreas = []
diff --git a/app/javascript/template_builder/page_context_menu.vue b/app/javascript/template_builder/page_context_menu.vue
new file mode 100644
index 00000000..61d49d23
--- /dev/null
+++ b/app/javascript/template_builder/page_context_menu.vue
@@ -0,0 +1,159 @@
+
+
+
+
+
+ {{ t('paste') }}
+
+ {{ isMac ? '⌘V' : 'Ctrl+V' }}
+
+
+
+
+
+ {{ isSelectModeRef.value ? t('draw_fields') : t('select_fields') }}
+
+ Tab
+
+
+
+
+ {{ t('autodetect_fields') }}
+
+
+
+
+
diff --git a/app/javascript/template_builder/selection_context_menu.vue b/app/javascript/template_builder/selection_context_menu.vue
new file mode 100644
index 00000000..d5328268
--- /dev/null
+++ b/app/javascript/template_builder/selection_context_menu.vue
@@ -0,0 +1,350 @@
+
+
+
+
+
+
+ {{ t('align_left') }}
+
+
+
+ {{ t('align_right') }}
+
+
+
+ {{ t('align_top') }}
+
+
+
+ {{ t('align_bottom') }}
+
+
+
+
+
+ {{ t('width') }}
+
+
+
+ {{ t('height') }}
+
+
+
+
+
+ {{ t('font') }}
+
+
+
+ {{ t('condition') }}
+
+
+
+
+
+ {{ t('copy') }}
+
+ {{ isMac ? '⌘C' : 'Ctrl+C' }}
+
+
+
+
+ {{ t('remove') }}
+
+ Del
+
+
+
+
+
+
+
+
+
+
+
+