Skip to content

Commit c5d3522

Browse files
committed
fix(actions-builder): adapt to vuejs3
1 parent eb80db6 commit c5d3522

File tree

2 files changed

+30
-24
lines changed

2 files changed

+30
-24
lines changed

tools/aceditor/presentation/javascripts/actions-builder.js

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,40 +29,39 @@ const ACTIONS_BACKWARD_COMPATIBILITY = {
2929
}
3030
console.log("actionsBuilderData", actionsBuilderData) // data variable has been defined in actions-builder.tpl.html
3131

32-
// Declare this one globally because we use it everywhere
33-
Vue.component('input-hint', InputHint)
34-
Vue.component('addon-icon', AddonIcon)
35-
Vue.component('v-select', VueSelect.VueSelect);
32+
// New for VueJs3
33+
const { createApp } = Vue
3634

3735
// Handle oldbrowser not supporting ES6
3836
if (!('noModule' in HTMLScriptElement.prototype)) {
3937
$('#actions-builder-app').empty().append('<p>Désolé, votre Navigateur est trop vieux pour utiliser cette fonctionalité.. Mettez le à jour ! ou <a href="https://www.mozilla.org/fr/firefox/new/">installez Firefox</a> </p>')
4038
} else {
4139

42-
window.myapp = new Vue({
43-
el: "#actions-builder-app",
40+
window.myapp = createApp({
4441
components: { InputPageList, InputText, InputCheckbox, InputList, InputIcon, InputColor,
4542
InputFormField, InputHidden, InputDivider,
4643
InputFacette, InputReaction, InputIconMapping, InputColorMapping, InputGeo, InputClass, InputCorrespondance,
4744
InputColumnsWidth,
4845
WikiCodeInput, PreviewAction },
4946
mixins: [ InputHelper ],
50-
data: {
51-
// Available Actions
52-
actionGroups: actionsBuilderData.action_groups,
53-
currentGroupId: '',
54-
selectedActionId: "",
55-
// Some Actions require to select a Form (like bazar actions)
56-
formIds: actionsBuilderData.forms, // list of this YesWiki Forms
57-
selectedFormId: "",
58-
selectedForm: null, // used only when useFormField is present
59-
loadedForms: {}, // we retrive Form by ajax, and store it in case we need to get it again
60-
// Values
61-
values: {},
62-
actionParams: {},
63-
// Aceditor
64-
editor: null,
65-
displayAdvancedParams: false,
47+
data(){
48+
return {
49+
// Available Actions
50+
actionGroups: actionsBuilderData.action_groups,
51+
currentGroupId: '',
52+
selectedActionId: "",
53+
// Some Actions require to select a Form (like bazar actions)
54+
formIds: actionsBuilderData.forms, // list of this YesWiki Forms
55+
selectedFormId: "",
56+
selectedForm: null, // used only when useFormField is present
57+
loadedForms: {}, // we retrive Form by ajax, and store it in case we need to get it again
58+
// Values
59+
values: {},
60+
actionParams: {},
61+
// Aceditor
62+
editor: null,
63+
displayAdvancedParams: false,
64+
}
6665
},
6766
computed: {
6867
actionGroup() { return this.currentGroupId ? this.actionGroups[this.currentGroupId] : {} },
@@ -270,3 +269,10 @@ window.myapp = new Vue({
270269
}
271270
});
272271
}
272+
273+
// Declare this one globally because we use it everywhere
274+
window.myapp.component('input-hint', InputHint)
275+
window.myapp.component('addon-icon', AddonIcon)
276+
window.myapp.component('v-select', VueSelect.VueSelect)
277+
278+
window.myapp.mount("#actions-builder-app")

tools/aceditor/presentation/templates/actions-builder.tpl.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ <h2 class="modal-title">{{ actionGroup.label }}</h2>
3838
:style="{width: panel.params.width || (configPanels.length == 1 ? '50%' : '33%')}" v-show="checkVisibility(panel.params)">
3939
<h3>{{ panel.params.title ? panel.params.title : '<?php echo _t('ACTION_BUILDER_PARAMETERS') ?>'}}</h3>
4040
<div class="config-panel-content">
41-
<template v-for="(config, propName) in panel.params.properties">
42-
<component :is="componentIdFrom(config)" :key="propName" :ref="refFrom(config)"
41+
<template v-for="(config, propName) in panel.params.properties" :key="propName" >
42+
<component :is="componentIdFrom(config)" :ref="refFrom(config)"
4343
:value="values[propName]" v-on:input="updateValue(propName, $event)"
4444
v-show="checkVisibility(config)"
4545
:name="propName" :values="values"

0 commit comments

Comments
 (0)