mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch '352-remove-wopi-link-module' into 'master'
Resolve "Code mort: module wopi-link semble inutilisé" Closes #352 See merge request Chill-Projet/chill-bundles!824
This commit is contained in:
commit
f207599d86
6
.changes/unreleased/DX-20250430-144550.yaml
Normal file
6
.changes/unreleased/DX-20250430-144550.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
kind: DX
|
||||
body: Remove dead code for wopi-link module
|
||||
time: 2025-04-30T14:45:50.406111606+02:00
|
||||
custom:
|
||||
Issue: "352"
|
||||
SchemaChange: No schema change
|
@ -11,6 +11,7 @@
|
||||
"@hotwired/stimulus": "^3.0.0",
|
||||
"@luminateone/eslint-baseline": "^1.0.9",
|
||||
"@symfony/stimulus-bridge": "^3.2.0",
|
||||
"@symfony/ux-translator": "file:vendor/symfony/ux-translator/assets",
|
||||
"@symfony/webpack-encore": "^4.1.0",
|
||||
"@tsconfig/node20": "^20.1.4",
|
||||
"@types/dompurify": "^3.0.5",
|
||||
|
@ -1,45 +0,0 @@
|
||||
import { createApp } from "vue";
|
||||
import OpenWopiLink from "ChillMainAssets/vuejs/_components/OpenWopiLink";
|
||||
import { _createI18n } from "ChillMainAssets/vuejs/_js/i18n";
|
||||
|
||||
const i18n = _createI18n({});
|
||||
|
||||
//TODO move to chillDocStore or ChillWopi
|
||||
|
||||
/*
|
||||
|
||||
tags to load module:
|
||||
|
||||
<span data-module="wopi-link"
|
||||
data-wopi-url="{{ path('chill_wopi_file_edit', {'fileId': document.uuid}) }}"
|
||||
data-doc-type="{{ document.type|e('html_attr') }}"
|
||||
data-options="{{ options|json_encode }}"
|
||||
></span>
|
||||
|
||||
*/
|
||||
|
||||
window.addEventListener("DOMContentLoaded", function (e) {
|
||||
document
|
||||
.querySelectorAll('span[data-module="wopi-link"]')
|
||||
.forEach(function (el) {
|
||||
createApp({
|
||||
template:
|
||||
'<open-wopi-link :wopiUrl="wopiUrl" :type="type" :options="options"></open-wopi-link>',
|
||||
components: {
|
||||
OpenWopiLink,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
wopiUrl: el.dataset.wopiUrl,
|
||||
type: el.dataset.docType,
|
||||
options:
|
||||
el.dataset.options !== "null"
|
||||
? JSON.parse(el.dataset.options)
|
||||
: {},
|
||||
};
|
||||
},
|
||||
})
|
||||
.use(i18n)
|
||||
.mount(el);
|
||||
});
|
||||
});
|
@ -1,214 +0,0 @@
|
||||
<template>
|
||||
<a
|
||||
v-if="isOpenDocument"
|
||||
class="btn"
|
||||
:class="[
|
||||
isChangeIcon ? 'change-icon' : '',
|
||||
isChangeClass ? options.changeClass : 'btn-wopilink',
|
||||
]"
|
||||
@click="openModal"
|
||||
>
|
||||
<i v-if="isChangeIcon" class="fa me-2" :class="options.changeIcon"></i>
|
||||
|
||||
<span v-if="!noText">
|
||||
{{ trans(WOPI_ONLINE_EDIT_DOCUMENT) }}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<teleport to="body">
|
||||
<div class="wopi-frame" v-if="isOpenDocument">
|
||||
<modal
|
||||
v-if="modal.showModal"
|
||||
:modalDialogClass="modal.modalDialogClass"
|
||||
:hideFooter="true"
|
||||
@close="modal.showModal = false"
|
||||
>
|
||||
<template #header>
|
||||
<img class="logo" :src="logo" height="45" />
|
||||
<span class="ms-auto me-3">
|
||||
<span v-if="options.title">{{ options.title }}</span>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<template #body>
|
||||
<div v-if="loading" class="loading">
|
||||
<i
|
||||
class="fa fa-circle-o-notch fa-spin fa-3x"
|
||||
:title="trans(WOPI_LOADING)"
|
||||
></i>
|
||||
</div>
|
||||
<iframe :src="this.wopiUrl" @load="loaded"></iframe>
|
||||
</template>
|
||||
</modal>
|
||||
</div>
|
||||
<div v-else>
|
||||
<Modal
|
||||
v-if="modal.showModal"
|
||||
modalDialogClass="modal-sm"
|
||||
@close="modal.showModal = false"
|
||||
>
|
||||
<template v-slot:header>
|
||||
<h3>{{ trans(WOPI_INVALID_TITLE) }}</h3>
|
||||
</template>
|
||||
<template v-slot:body>
|
||||
<div class="alert alert-warning">
|
||||
{{ trans(WOPI_ONLINE_EDIT_DOCUMENT) }}
|
||||
</div>
|
||||
</template>
|
||||
</Modal>
|
||||
</div>
|
||||
</teleport>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from "vue";
|
||||
import {
|
||||
trans,
|
||||
WOPI_ONLINE_EDIT_DOCUMENT,
|
||||
WOPI_INVALID_TITLE,
|
||||
WOPI_LOADING,
|
||||
} from "translator";
|
||||
import Modal from "ChillMainAssets/vuejs/_components/Modal";
|
||||
import logo from "ChillMainAssets/chill/img/logo-chill-sans-slogan_white.png";
|
||||
|
||||
// Props
|
||||
const props = defineProps({
|
||||
wopiUrl: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
options: {
|
||||
type: Object,
|
||||
required: false,
|
||||
},
|
||||
});
|
||||
|
||||
// data
|
||||
const modal = ref({
|
||||
showModal: false,
|
||||
modalDialogClass: "modal-fullscreen",
|
||||
});
|
||||
const loading = ref(false);
|
||||
|
||||
// MIME types
|
||||
const mime = [
|
||||
// TODO temporary hardcoded. to be replaced by twig extension or a collabora server query
|
||||
"application/clarisworks",
|
||||
"application/coreldraw",
|
||||
"application/macwriteii",
|
||||
"application/msword",
|
||||
"application/pdf",
|
||||
"application/vnd.lotus-1-2-3",
|
||||
"application/vnd.ms-excel",
|
||||
"application/vnd.ms-excel.sheet.binary.macroEnabled.12",
|
||||
"application/vnd.ms-excel.sheet.macroEnabled.12",
|
||||
"application/vnd.ms-excel.template.macroEnabled.12",
|
||||
"application/vnd.ms-powerpoint",
|
||||
"application/vnd.ms-powerpoint.presentation.macroEnabled.12",
|
||||
"application/vnd.ms-powerpoint.template.macroEnabled.12",
|
||||
"application/vnd.ms-visio.drawing",
|
||||
"application/vnd.ms-word.document.macroEnabled.12",
|
||||
"application/vnd.ms-word.template.macroEnabled.12",
|
||||
"application/vnd.ms-works",
|
||||
"application/vnd.oasis.opendocument.chart",
|
||||
"application/vnd.oasis.opendocument.formula",
|
||||
"application/vnd.oasis.opendocument.graphics",
|
||||
"application/vnd.oasis.opendocument.graphics-flat-xml",
|
||||
"application/vnd.oasis.opendocument.graphics-template",
|
||||
"application/vnd.oasis.opendocument.presentation",
|
||||
"application/vnd.oasis.opendocument.presentation-flat-xml",
|
||||
"application/vnd.oasis.opendocument.presentation-template",
|
||||
"application/vnd.oasis.opendocument.spreadsheet",
|
||||
"application/vnd.oasis.opendocument.spreadsheet-flat-xml",
|
||||
"application/vnd.oasis.opendocument.spreadsheet-template",
|
||||
"application/vnd.oasis.opendocument.text",
|
||||
"application/vnd.oasis.opendocument.text-flat-xml",
|
||||
"application/vnd.oasis.opendocument.text-master",
|
||||
"application/vnd.oasis.opendocument.text-master-template",
|
||||
"application/vnd.oasis.opendocument.text-template",
|
||||
"application/vnd.oasis.opendocument.text-web",
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.slideshow",
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.template",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.template",
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.template",
|
||||
"application/vnd.sun.xml.calc",
|
||||
"application/vnd.sun.xml.calc.template",
|
||||
"application/vnd.sun.xml.chart",
|
||||
"application/vnd.sun.xml.draw",
|
||||
"application/vnd.sun.xml.draw.template",
|
||||
"application/vnd.sun.xml.impress",
|
||||
"application/vnd.sun.xml.impress.template",
|
||||
"application/vnd.sun.xml.math",
|
||||
"application/vnd.sun.xml.writer",
|
||||
"application/vnd.sun.xml.writer.global",
|
||||
"application/vnd.sun.xml.writer.template",
|
||||
"application/vnd.visio",
|
||||
"application/vnd.visio2013",
|
||||
"application/vnd.wordperfect",
|
||||
"application/x-abiword",
|
||||
"application/x-aportisdoc",
|
||||
"application/x-dbase",
|
||||
"application/x-dif-document",
|
||||
"application/x-fictionbook+xml",
|
||||
"application/x-gnumeric",
|
||||
"application/x-hwp",
|
||||
"application/x-iwork-keynote-sffkey",
|
||||
"application/x-iwork-numbers-sffnumbers",
|
||||
"application/x-iwork-pages-sffpages",
|
||||
"application/x-mspublisher",
|
||||
"application/x-mswrite",
|
||||
"application/x-pagemaker",
|
||||
"application/x-sony-bbeb",
|
||||
"application/x-t602",
|
||||
];
|
||||
|
||||
// Computed
|
||||
const isOpenDocument = computed(() => mime.includes(props.type));
|
||||
|
||||
const noText = computed(() => props.options?.noText === true);
|
||||
|
||||
const isChangeIcon = computed(() => !!props.options?.changeIcon);
|
||||
|
||||
const isChangeClass = computed(() => !!props.options?.changeClass);
|
||||
|
||||
// Methods
|
||||
const openModal = () => {
|
||||
loading.value = true;
|
||||
modal.value.showModal = true;
|
||||
};
|
||||
|
||||
const loaded = () => {
|
||||
loading.value = false;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
div.wopi-frame {
|
||||
div.modal-header {
|
||||
border-bottom: 0;
|
||||
background-color: var(--bs-primary);
|
||||
color: white;
|
||||
}
|
||||
div.modal-body {
|
||||
padding: 0;
|
||||
overflow-y: unset !important;
|
||||
iframe {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
div.loading {
|
||||
position: absolute;
|
||||
color: var(--bs-chill-gray);
|
||||
top: calc(50% - 30px);
|
||||
left: calc(50% - 30px);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
@ -9,7 +9,6 @@
|
||||
{{ encore_entry_script_tags('mod_pickentity_type') }}
|
||||
{{ encore_entry_script_tags('mod_entity_workflow_subscribe') }}
|
||||
{{ encore_entry_script_tags('page_workflow_show') }}
|
||||
{{ encore_entry_script_tags('mod_wopi_link') }}
|
||||
{{ encore_entry_script_tags('mod_document_action_buttons_group') }}
|
||||
{{ encore_entry_script_tags('mod_workflow_attachment') }}
|
||||
{% endblock %}
|
||||
@ -19,7 +18,6 @@
|
||||
{{ encore_entry_link_tags('mod_pickentity_type') }}
|
||||
{{ encore_entry_link_tags('mod_entity_workflow_subscribe') }}
|
||||
{{ encore_entry_link_tags('page_workflow_show') }}
|
||||
{{ encore_entry_link_tags('mod_wopi_link') }}
|
||||
{{ encore_entry_link_tags('mod_document_action_buttons_group') }}
|
||||
{{ encore_entry_link_tags('mod_workflow_attachment') }}
|
||||
{% endblock %}
|
||||
|
@ -86,10 +86,6 @@ module.exports = function (encore, entries) {
|
||||
"mod_entity_workflow_pick",
|
||||
__dirname + "/Resources/public/module/entity-workflow-pick/index.js",
|
||||
);
|
||||
encore.addEntry(
|
||||
"mod_wopi_link",
|
||||
__dirname + "/Resources/public/module/wopi-link/index.js",
|
||||
);
|
||||
encore.addEntry(
|
||||
"mod_pick_postal_code",
|
||||
__dirname + "/Resources/public/module/pick-postal-code/index.js",
|
||||
|
Loading…
x
Reference in New Issue
Block a user