glib-web 0.18.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :style="$styles()" :class="$classes()">
|
|
3
3
|
<v-progress-linear v-if="showProgress" v-model="progress.value" />
|
|
4
|
-
<VueEditor
|
|
5
|
-
|
|
4
|
+
<VueEditor
|
|
5
|
+
v-model="rawValue"
|
|
6
|
+
:editor-toolbar="customToolbar"
|
|
7
|
+
use-custom-image-handler
|
|
8
|
+
@text-change="separateOutImages"
|
|
9
|
+
@image-added="uploadImage"
|
|
10
|
+
/>
|
|
11
|
+
<input type="hidden" :name="spec.name" :value="produceValue" />
|
|
6
12
|
<input
|
|
7
13
|
v-for="(imageKey, index) in imageKeys"
|
|
8
14
|
:key="index"
|
|
9
|
-
type="
|
|
15
|
+
type="hidden"
|
|
10
16
|
:name="imageUploader.name"
|
|
11
17
|
:value="images[imageKey]"
|
|
12
18
|
/>
|
|
@@ -41,29 +47,23 @@ export default {
|
|
|
41
47
|
imageKeys: [],
|
|
42
48
|
progress: { value: -1 },
|
|
43
49
|
imageUploader: {},
|
|
50
|
+
produce: "markdown",
|
|
44
51
|
turndownService: new TurndownService({ headingStyle: "atx" })
|
|
45
52
|
}),
|
|
46
53
|
computed: {
|
|
47
54
|
showProgress: function() {
|
|
48
55
|
return this.progress.value >= 0;
|
|
49
56
|
},
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
produceValue: function() {
|
|
58
|
+
if (this.produce == "html") {
|
|
59
|
+
return this.cleanValue;
|
|
60
|
+
} else if (this.produce == "markdown") {
|
|
61
|
+
return this.turndownService.turndown(this.cleanValue);
|
|
62
|
+
} else {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
52
65
|
}
|
|
53
66
|
},
|
|
54
|
-
// mounted: function () {
|
|
55
|
-
// const vm = this
|
|
56
|
-
// this.rawValue = (this.spec.value || "").replace(/\{\{image([0-9]+)\}\}/g, function (_, index) {
|
|
57
|
-
// const image = vm.spec.images[index - 1]
|
|
58
|
-
// if (image && vm.$type.isString(image.value) && vm.$type.isString(image.fileUrl)) {
|
|
59
|
-
// const url = image.fileUrl
|
|
60
|
-
// const key = url.hashCode().toString()
|
|
61
|
-
// vm.images[key] = image.value
|
|
62
|
-
// return `<img src="${url}">`
|
|
63
|
-
// }
|
|
64
|
-
// return "{{IMAGE_NOT_FOUND}}"
|
|
65
|
-
// })
|
|
66
|
-
// },
|
|
67
67
|
mounted() {
|
|
68
68
|
this.registerScrollEvent();
|
|
69
69
|
},
|
|
@@ -90,13 +90,16 @@ export default {
|
|
|
90
90
|
const url = image.fileUrl;
|
|
91
91
|
const key = url.hashCode().toString();
|
|
92
92
|
vm.images[key] = image.value;
|
|
93
|
-
return
|
|
93
|
+
return url;
|
|
94
94
|
}
|
|
95
95
|
return "{{IMAGE_NOT_FOUND}}";
|
|
96
96
|
}
|
|
97
97
|
);
|
|
98
98
|
|
|
99
99
|
this.imageUploader = this.spec.imageUploader;
|
|
100
|
+
if (this.spec.produce) {
|
|
101
|
+
this.produce = this.spec.produce;
|
|
102
|
+
}
|
|
100
103
|
},
|
|
101
104
|
uploadImage: function(file, editor, cursorLocation) {
|
|
102
105
|
let vm = this;
|
|
@@ -202,7 +202,10 @@ export default {
|
|
|
202
202
|
// Has to be executed before $ready(). This executes regardless of whether a form is found because fields
|
|
203
203
|
// may be used without a form.
|
|
204
204
|
this.fieldName = this.spec.name;
|
|
205
|
-
|
|
205
|
+
// Don't initialize fieldModel unnecessarily because this will trigger validations on page load
|
|
206
|
+
if (this.spec.value) {
|
|
207
|
+
this.fieldModel = this._sanitizeValue(this.spec.value);
|
|
208
|
+
}
|
|
206
209
|
}
|
|
207
210
|
},
|
|
208
211
|
$classes(spec) {
|
package/nav/drawer.vue
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<panels-responsive :spec="spec.header" />
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
|
-
<glib-component v-if="spec.
|
|
29
|
+
<glib-component v-if="spec.body" :spec="spec.body" />
|
|
30
30
|
|
|
31
31
|
<v-list dense class="pt-0">
|
|
32
32
|
<div v-for="(item, index) in spec.rows" :key="index" class="nav-item">
|