adjust native

This commit is contained in:
Pete Matsyburka committed 2026-09-23 11:00:17 +03:00
1 parent a86f896694
commit d35538e2ba
17 files changed
+121 -96

No files matched your search

@@ -272,7 +272,7 @@ export default {
FieldSubmitter,
IconX
},
inject: ['t', 'isMobile'],
inject: ['t', 'isMobile', 'nativePlatform'],
props: {
template: {
type: Object,
@@ -387,28 +387,28 @@ export default {
},
methods: {
openFormulaModal () {
if (window.webkit?.messageHandlers?.modal) {
if (this.nativePlatform && window.webkit?.messageHandlers?.modal) {
window.webkit.messageHandlers.modal.postMessage({ action: 'sheet', name: 'formula', detent: 'medium', uuid: this.field.uuid })
} else {
this.isShowFormulaModal = true
}
},
openFontModal () {
if (window.webkit?.messageHandlers?.modal) {
if (this.nativePlatform && window.webkit?.messageHandlers?.modal) {
window.webkit.messageHandlers.modal.postMessage({ action: 'sheet', name: 'font', detent: 'medium', uuid: this.field.uuid })
} else {
this.isShowFontModal = true
}
},
openConditionsModal () {
if (window.webkit?.messageHandlers?.modal) {
if (this.nativePlatform && window.webkit?.messageHandlers?.modal) {
window.webkit.messageHandlers.modal.postMessage({ action: 'sheet', name: 'conditions', detent: 'medium', uuid: this.field.uuid })
} else {
this.isShowConditionsModal = true
}
},
openDescriptionModal () {
if (window.webkit?.messageHandlers?.modal) {
if (this.nativePlatform && window.webkit?.messageHandlers?.modal) {
window.webkit.messageHandlers.modal.postMessage({ action: 'sheet', name: 'description', detent: 'medium', uuid: this.field.uuid })
} else {
this.isShowDescriptionModal = true
+6 -4
View File
@@ -1929,7 +1929,7 @@ export default {
download () {
const download = window.webkit?.messageHandlers?.download
if (download) return download.postMessage({ src: `/templates/${this.template.id}/documents` })
if (this.nativePlatform && download) return download.postMessage({ src: `/templates/${this.template.id}/documents` })
this.isDownloading = true
@@ -2203,7 +2203,7 @@ export default {
this.loadRevisionsPromise ||= this.baseFetch(`/templates/${this.template.id}/versions`)
},
openRevisionsModal () {
if (window.webkit?.messageHandlers?.modal) {
if (this.nativePlatform && window.webkit?.messageHandlers?.modal) {
return window.webkit.messageHandlers.modal.postMessage({ action: 'sheet', name: 'revisions', detent: 'medium' })
}
@@ -2220,7 +2220,7 @@ export default {
})
},
openDocumentsEditor (item) {
if (window.webkit?.messageHandlers?.modal) {
if (this.nativePlatform && window.webkit?.messageHandlers?.modal) {
window.webkit.messageHandlers.modal.postMessage({ action: 'sheet', name: 'documents', viewport: 'fixed', uuid: item.attachment_uuid })
} else {
this.editModalDocumentUuid = item.attachment_uuid
@@ -2438,7 +2438,9 @@ export default {
ref?.$el.scrollIntoView({ behavior: 'smooth', block: 'start' })
},
postNativeEvent (name, detail, dismiss = false) {
window.webkit?.messageHandlers?.modal?.postMessage({ action: 'dispatch', name, detail: JSON.stringify(detail), dismiss: dismiss ? 'true' : 'false' })
if (this.nativePlatform) {
window.webkit?.messageHandlers?.modal?.postMessage({ action: 'dispatch', name, detail: JSON.stringify(detail), dismiss: dismiss ? 'true' : 'false' })
}
},
onDrawerScrollTo (item) {
if (this.nativeView) {
@@ -209,7 +209,7 @@ export default {
IconTrashX,
FieldType
},
inject: ['backgroundColor', 't', 'isMobile'],
inject: ['backgroundColor', 't', 'isMobile', 'nativePlatform'],
props: {
field: {
type: Object,
@@ -261,21 +261,21 @@ export default {
},
methods: {
openFormulaModal () {
if (window.webkit?.messageHandlers?.modal) {
if (this.nativePlatform && window.webkit?.messageHandlers?.modal) {
window.webkit.messageHandlers.modal.postMessage({ action: 'sheet', name: 'formula', detent: 'medium', custom_field_uuid: this.field.uuid })
} else {
this.isShowFormulaModal = true
}
},
openFontModal () {
if (window.webkit?.messageHandlers?.modal) {
if (this.nativePlatform && window.webkit?.messageHandlers?.modal) {
window.webkit.messageHandlers.modal.postMessage({ action: 'sheet', name: 'font', detent: 'medium', custom_field_uuid: this.field.uuid })
} else {
this.isShowFontModal = true
}
},
openDescriptionModal () {
if (window.webkit?.messageHandlers?.modal) {
if (this.nativePlatform && window.webkit?.messageHandlers?.modal) {
window.webkit.messageHandlers.modal.postMessage({ action: 'sheet', name: 'description', detent: 'medium', custom_field_uuid: this.field.uuid })
} else {
this.isShowDescriptionModal = true
+7 -2
View File
@@ -38,7 +38,12 @@
v-if="withDescription"
class="text-sm"
>
<span class="font-medium">{{ t('click_to_upload') }}</span> {{ t('or_drag_and_drop_files') }}
<template v-if="isMobile">
{{ t('click_to_upload') }}
</template>
<template v-else>
<span class="font-medium">{{ t('click_to_upload') }}</span> {{ t('or_drag_and_drop_files') }}
</template>
</div>
<button
v-if="withGoogleDrive"
@@ -83,7 +88,7 @@ export default {
IconFiles,
IconBrandGoogleDrive
},
inject: ['baseFetch', 't'],
inject: ['baseFetch', 't', 'isMobile'],
props: {
templateId: {
type: [Number, String],
+5 -5
View File
@@ -424,7 +424,7 @@ export default {
IconMathFunction,
FieldType
},
inject: ['template', 'backgroundColor', 'selectedAreasRef', 't', 'locale', 'getFieldTypeIndex', 'dateFormats', 'isMobile'],
inject: ['template', 'backgroundColor', 'selectedAreasRef', 't', 'locale', 'getFieldTypeIndex', 'dateFormats', 'isMobile', 'nativePlatform'],
props: {
field: {
type: Object,
@@ -559,28 +559,28 @@ export default {
this.$emit('save')
},
openFormulaModal () {
if (window.webkit?.messageHandlers?.modal) {
if (this.nativePlatform && window.webkit?.messageHandlers?.modal) {
window.webkit.messageHandlers.modal.postMessage({ action: 'sheet', name: 'formula', detent: 'medium', uuid: this.field.uuid })
} else {
this.isShowFormulaModal = true
}
},
openFontModal () {
if (window.webkit?.messageHandlers?.modal) {
if (this.nativePlatform && window.webkit?.messageHandlers?.modal) {
window.webkit.messageHandlers.modal.postMessage({ action: 'sheet', name: 'font', detent: 'medium', uuid: this.field.uuid })
} else {
this.isShowFontModal = true
}
},
openConditionsModal () {
if (window.webkit?.messageHandlers?.modal) {
if (this.nativePlatform && window.webkit?.messageHandlers?.modal) {
window.webkit.messageHandlers.modal.postMessage({ action: 'sheet', name: 'conditions', detent: 'medium', uuid: this.field.uuid })
} else {
this.isShowConditionsModal = true
}
},
openDescriptionModal () {
if (window.webkit?.messageHandlers?.modal) {
if (this.nativePlatform && window.webkit?.messageHandlers?.modal) {
window.webkit.messageHandlers.modal.postMessage({ action: 'sheet', name: 'description', detent: 'medium', uuid: this.field.uuid })
} else {
this.isShowDescriptionModal = true
+3 -1
View File
@@ -874,7 +874,9 @@ export default {
this.save()
window.webkit?.messageHandlers?.flash?.postMessage({ style: 'notice', message: this.t('fields_detected').replace('{count}', (data.fields || fields).length) })
if (this.nativePlatform) {
window.webkit?.messageHandlers?.flash?.postMessage({ style: 'notice', message: this.t('fields_detected').replace('{count}', (data.fields || fields).length) })
}
break
} else if (data.fields) {
@@ -93,7 +93,7 @@ export default {
RevisionsModal,
IconInnerShadowTop
},
inject: ['t', 'template', 'locale', 'baseFetch', 'getFieldTypeIndex', 'save'],
inject: ['t', 'template', 'locale', 'baseFetch', 'getFieldTypeIndex', 'save', 'nativePlatform'],
props: {
defaultFields: {
type: Array,
@@ -203,7 +203,9 @@ export default {
document.body.style.overflow = ''
},
close () {
window.webkit?.messageHandlers?.modal?.postMessage({ action: 'closeSheet' })
if (this.nativePlatform) {
window.webkit?.messageHandlers?.modal?.postMessage({ action: 'closeSheet' })
}
},
onSave () {
if (this.modal?.custom_field_uuid) {
@@ -222,7 +224,9 @@ export default {
this.customFields.splice(0, this.customFields.length, ...fields)
window.webkit?.messageHandlers?.modal?.postMessage({ action: 'dispatch', name: 'template-builder:sync-custom-fields', detail: JSON.stringify(fields), dismiss: 'false' })
if (this.nativePlatform) {
window.webkit?.messageHandlers?.modal?.postMessage({ action: 'dispatch', name: 'template-builder:sync-custom-fields', detail: JSON.stringify(fields), dismiss: 'false' })
}
})
},
loadRevisions () {
@@ -233,7 +237,9 @@ export default {
})
},
applyRevision (revision) {
window.webkit?.messageHandlers?.modal?.postMessage({ action: 'dispatch', name: 'template-builder:apply-revision', detail: JSON.stringify(revision), dismiss: 'true' })
if (this.nativePlatform) {
window.webkit?.messageHandlers?.modal?.postMessage({ action: 'dispatch', name: 'template-builder:apply-revision', detail: JSON.stringify(revision), dismiss: 'true' })
}
},
onDocumentsSaved (data) {
this.$emit('documents-modified', data)
+2 -2
View File
@@ -211,7 +211,7 @@ export default {
IconBolt,
IconPencil
},
inject: ['t', 'getFieldTypeIndex', 'baseFetch', 'isMobile'],
inject: ['t', 'getFieldTypeIndex', 'baseFetch', 'isMobile', 'nativePlatform'],
props: {
item: {
type: Object,
@@ -290,7 +290,7 @@ export default {
},
methods: {
openConditionsModal () {
if (window.webkit?.messageHandlers?.modal) {
if (this.nativePlatform && window.webkit?.messageHandlers?.modal) {
window.webkit.messageHandlers.modal.postMessage({ action: 'sheet', name: 'conditions', detent: 'medium', attachment_uuid: this.item.attachment_uuid })
} else {
this.isShowConditionsModal = true