@mixd-id/web-scaffold 0.1.2301231369 → 0.2.240702
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.
- package/LICENSE +1 -0
- package/docs/components/Header2.md +16 -0
- package/docs/components/TreeView.md +0 -0
- package/package.json +22 -5
- package/src/App.vue +9 -1
- package/src/components/Ahref.vue +175 -9
- package/src/components/Alert.vue +181 -75
- package/src/components/Article.vue +393 -0
- package/src/components/Block.vue +31 -0
- package/src/components/Box.vue +34 -0
- package/src/components/Button.vue +208 -129
- package/src/components/Carousel.vue +194 -124
- package/src/components/Chart.vue +485 -0
- package/src/components/ChartBar.vue +193 -0
- package/src/components/Checkbox.vue +95 -55
- package/src/components/CodeEditor.vue +61 -0
- package/src/components/ColorPicker.vue +158 -0
- package/src/components/ColorPicker2.vue +164 -0
- package/src/components/Confirm.vue +178 -0
- package/src/components/ContextMenu.vue +164 -76
- package/src/components/ConversationBuilder.vue +161 -0
- package/src/components/CopyToClipboard.vue +6 -31
- package/src/components/Countdown.vue +104 -53
- package/src/components/DGrid.vue +21 -0
- package/src/components/DGridItem.vue +263 -0
- package/src/components/DataList.vue +92 -0
- package/src/components/Datepicker.vue +65 -41
- package/src/components/DayTimeRange.vue +125 -0
- package/src/components/Dropdown.vue +32 -9
- package/src/components/ErrorText.vue +30 -9
- package/src/components/FBLogin.vue +194 -0
- package/src/components/Flex.vue +70 -0
- package/src/components/GSignIn.vue +166 -0
- package/src/components/Gmaps.vue +35 -11
- package/src/components/Grid.vue +24 -20
- package/src/components/HTMLEditor.vue +258 -79
- package/src/components/IconMenu.vue +95 -0
- package/src/components/IconMenu2.vue +89 -0
- package/src/components/IconPlus.vue +89 -0
- package/src/components/Image.vue +161 -59
- package/src/components/Image360.vue +2 -2
- package/src/components/ImagePreview.vue +23 -11
- package/src/components/ImportModal.vue +27 -14
- package/src/components/Link.vue +39 -0
- package/src/components/List.vue +1177 -0
- package/src/components/ListItem.vue +32 -21
- package/src/components/ListPage1.vue +88 -17
- package/src/components/ListPage1Filter.vue +2 -2
- package/src/components/ListView.vue +962 -0
- package/src/components/ListViewBarSummary.vue +81 -0
- package/src/components/ListViewLineSummary.vue +75 -0
- package/src/components/ListViewLiveBarSummary.vue +52 -0
- package/src/components/ListViewMapSummary.vue +56 -0
- package/src/components/ListViewSettings.vue +514 -0
- package/src/components/ListViewTableSummary.vue +77 -0
- package/src/components/LogViewerItem.vue +116 -0
- package/src/components/Modal.vue +274 -122
- package/src/components/MultilineText.vue +177 -0
- package/src/components/OTPField.vue +5 -6
- package/src/components/ObjectTree.vue +105 -0
- package/src/components/PageBuilder.vue +449 -0
- package/src/components/Paragraph.vue +41 -0
- package/src/components/PresetSelectorFilterItem.vue +178 -0
- package/src/components/Radio.vue +62 -87
- package/src/components/SearchButton.vue +1 -1
- package/src/components/Slider.vue +107 -75
- package/src/components/Svg.vue +33 -0
- package/src/components/Switch.vue +15 -5
- package/src/components/TabView.vue +0 -1
- package/src/components/Table.vue +56 -0
- package/src/components/TableViewHead.vue +2 -2
- package/src/components/Tabs.vue +68 -11
- package/src/components/Test.vue +23 -0
- package/src/components/Testimonial.vue +86 -0
- package/src/components/Text.vue +49 -0
- package/src/components/TextBlock.vue +50 -0
- package/src/components/TextWithTag.vue +225 -0
- package/src/components/Textarea.vue +22 -16
- package/src/components/Textbox.vue +83 -62
- package/src/components/Thumbnail.vue +27 -0
- package/src/components/Timepicker.vue +15 -8
- package/src/components/Toast.vue +60 -38
- package/src/components/TreeView.vue +101 -0
- package/src/components/TreeViewItem.vue +424 -0
- package/src/components/TreeViewItem1.vue +282 -0
- package/src/components/VirtualGrid.vue +284 -0
- package/src/components/VirtualScroll.vue +88 -21
- package/src/components/VirtualTable.vue +277 -71
- package/src/components/YoutubeVideo.vue +196 -0
- package/src/configs/icons-fa.json +12 -0
- package/src/events/event.js +2 -0
- package/src/index.js +477 -53
- package/src/main.js +0 -9
- package/src/middleware/http/trim-string.js +20 -0
- package/src/mixin/component.js +222 -0
- package/src/mixin/website.js +121 -0
- package/src/stores/components.js +36 -0
- package/src/themes/default/index.js +178 -34
- package/src/utils/helpers.js +378 -7
- package/src/utils/helpers.mjs +274 -16
- package/src/utils/importer.js +60 -26
- package/src/utils/listpage1.js +403 -267
- package/src/utils/listview.js +1287 -0
- package/src/utils/preset-selector.js +1055 -0
- package/src/utils/preset-selector.mjs +185 -0
- package/src/utils/selection.js +15 -36
- package/src/utils/web.js +50 -0
- package/src/utils/wss.js +294 -0
- package/src/utils/wss.mjs +280 -0
- package/src/widgets/AhrefSetting.vue +94 -0
- package/src/widgets/ArticleSetting.vue +469 -0
- package/src/widgets/BackgroundSetting.vue +132 -0
- package/src/widgets/BlockSetting.vue +49 -0
- package/src/widgets/BorderSetting.vue +201 -0
- package/src/widgets/BoxSetting.vue +53 -0
- package/src/widgets/ButtonSetting.vue +114 -0
- package/src/widgets/CarouselSetting.vue +193 -0
- package/src/widgets/ColumnSelector.vue +80 -0
- package/src/widgets/ComponentPropertyLabel.vue +35 -0
- package/src/widgets/ComponentPropertySelector.vue +115 -0
- package/src/widgets/ComponentSetting.vue +2220 -0
- package/src/widgets/ComponentSetting2.vue +1018 -0
- package/src/widgets/ComponentSetting3.vue +231 -0
- package/src/widgets/ContactForm.vue +193 -0
- package/src/widgets/ContactFormSetting.vue +384 -0
- package/src/widgets/CountdownSetting.vue +76 -0
- package/src/widgets/DataListSetting.vue +102 -0
- package/src/widgets/EffectSetting.vue +94 -0
- package/src/widgets/EmbeddedVideo.vue +60 -0
- package/src/widgets/EmbeddedVideoSetting.vue +48 -0
- package/src/widgets/FAQ.vue +85 -0
- package/src/widgets/FAQSetting.vue +88 -0
- package/src/widgets/FeatureList.vue +128 -0
- package/src/widgets/FeatureListSetting.vue +223 -0
- package/src/widgets/FiltersSetting.vue +88 -0
- package/src/widgets/FlexSetting.vue +197 -0
- package/src/widgets/GridSetting.vue +290 -0
- package/src/widgets/Header.vue +15 -0
- package/src/widgets/Header1.vue +41 -0
- package/src/widgets/Header1Setting.vue +75 -0
- package/src/widgets/Header2.vue +102 -0
- package/src/widgets/Header2Setting.vue +277 -0
- package/src/widgets/HeaderSetting.vue +104 -0
- package/src/widgets/IconList.vue +51 -0
- package/src/widgets/IconListSetting.vue +184 -0
- package/src/widgets/ImageSetting.vue +146 -0
- package/src/widgets/LayoutSetting.vue +251 -0
- package/src/widgets/LinkSetting.vue +186 -0
- package/src/widgets/LogViewer.vue +85 -0
- package/src/widgets/MarginPaddingSetting.vue +58 -0
- package/src/widgets/MarginSetting.vue +142 -0
- package/src/widgets/MenuEditor.vue +256 -0
- package/src/widgets/MobileMenu.vue +182 -0
- package/src/widgets/ModalSetting.vue +96 -0
- package/src/widgets/MultiValueSetting.vue +121 -0
- package/src/widgets/MultiValueSetting2.vue +114 -0
- package/src/widgets/PaddingSetting.vue +142 -0
- package/src/widgets/ParagraphSetting.vue +86 -0
- package/src/widgets/PresetBar.vue +880 -0
- package/src/widgets/PresetBarPivotColumnEdit.vue +197 -0
- package/src/widgets/PresetSelector.vue +673 -0
- package/src/widgets/Review.vue +131 -0
- package/src/widgets/ReviewSetting.vue +201 -0
- package/src/widgets/Share.vue +165 -0
- package/src/widgets/ShareSetting.vue +92 -0
- package/src/widgets/SizingSetting.vue +306 -0
- package/src/widgets/SpacingSetting.vue +77 -0
- package/src/widgets/StyleSetting.vue +328 -0
- package/src/widgets/StyleSetting2.vue +90 -0
- package/src/widgets/SvgSetting.vue +133 -0
- package/src/widgets/TableSetting.vue +172 -0
- package/src/widgets/TestimonialSetting.vue +152 -0
- package/src/widgets/TextBlockSetting.vue +78 -0
- package/src/widgets/ThumbnailSetting.vue +49 -0
- package/src/widgets/TransitionSetting.vue +64 -0
- package/src/widgets/TypographySetting.vue +334 -0
- package/src/widgets/UserActionBuilder/UserActionItem.vue +165 -0
- package/src/widgets/UserActionBuilder/UserActionOutput.vue +126 -0
- package/src/widgets/UserActionBuilder.vue +457 -0
- package/src/widgets/WebComponentSelector.vue +201 -0
- package/src/widgets/WebDatasourceSelector.vue +153 -0
- package/src/widgets/WebLayoutSelector.vue +376 -0
- package/src/widgets/WebPageBuilder.vue +1849 -0
- package/src/widgets/WebPageBuilder2.vue +1091 -0
- package/src/widgets/WebPageBuilder3.vue +411 -0
- package/src/widgets/WebPageBuilder4/ActionSetting.vue +158 -0
- package/src/widgets/WebPageBuilder4/BackgroundColorSetting.vue +54 -0
- package/src/widgets/WebPageBuilder4/BackgroundPositionSetting.vue +75 -0
- package/src/widgets/WebPageBuilder4/BackgroundRepeatSetting.vue +72 -0
- package/src/widgets/WebPageBuilder4/BackgroundSizeSetting.vue +72 -0
- package/src/widgets/WebPageBuilder4/BlurSetting.vue +72 -0
- package/src/widgets/WebPageBuilder4/BorderColorSetting.vue +64 -0
- package/src/widgets/WebPageBuilder4/BorderRadiusSetting.vue +75 -0
- package/src/widgets/WebPageBuilder4/BorderSizeSetting.vue +69 -0
- package/src/widgets/WebPageBuilder4/BorderStyleSetting.vue +72 -0
- package/src/widgets/WebPageBuilder4/BoxShadowSetting.vue +73 -0
- package/src/widgets/WebPageBuilder4/ButtonSetting.vue +73 -0
- package/src/widgets/WebPageBuilder4/CarouselSetting.vue +122 -0
- package/src/widgets/WebPageBuilder4/ColorSetting.vue +63 -0
- package/src/widgets/WebPageBuilder4/DataSetting.vue +92 -0
- package/src/widgets/WebPageBuilder4/DisplaySetting.vue +76 -0
- package/src/widgets/WebPageBuilder4/FlexAlignSetting.vue +71 -0
- package/src/widgets/WebPageBuilder4/FlexDirectionSetting.vue +70 -0
- package/src/widgets/WebPageBuilder4/FlexJustifySetting.vue +74 -0
- package/src/widgets/WebPageBuilder4/FlexPropertySetting.vue +71 -0
- package/src/widgets/WebPageBuilder4/FlexSetting.vue +105 -0
- package/src/widgets/WebPageBuilder4/FlexWrapSetting.vue +69 -0
- package/src/widgets/WebPageBuilder4/FontSizeSetting.vue +76 -0
- package/src/widgets/WebPageBuilder4/GapSetting.vue +75 -0
- package/src/widgets/WebPageBuilder4/GrayscaleSetting.vue +68 -0
- package/src/widgets/WebPageBuilder4/GridSetting.vue +166 -0
- package/src/widgets/WebPageBuilder4/HeightSetting.vue +95 -0
- package/src/widgets/WebPageBuilder4/ImageSetting.vue +102 -0
- package/src/widgets/WebPageBuilder4/LinkSetting.vue +68 -0
- package/src/widgets/WebPageBuilder4/MarginSetting.vue +70 -0
- package/src/widgets/WebPageBuilder4/MaxHeightSetting.vue +82 -0
- package/src/widgets/WebPageBuilder4/MaxWidthSetting.vue +90 -0
- package/src/widgets/WebPageBuilder4/MinHeightSetting.vue +81 -0
- package/src/widgets/WebPageBuilder4/MinWidthSetting.vue +101 -0
- package/src/widgets/WebPageBuilder4/MobileMenuSetting.vue +106 -0
- package/src/widgets/WebPageBuilder4/MultiValueSetting.vue +155 -0
- package/src/widgets/WebPageBuilder4/OpacitySetting.vue +77 -0
- package/src/widgets/WebPageBuilder4/OverflowSetting.vue +81 -0
- package/src/widgets/WebPageBuilder4/PaddingSetting.vue +53 -0
- package/src/widgets/WebPageBuilder4/PositionSetting.vue +191 -0
- package/src/widgets/WebPageBuilder4/PropertySetting.vue +183 -0
- package/src/widgets/WebPageBuilder4/Setting.vue +73 -0
- package/src/widgets/WebPageBuilder4/StyleSetting.vue +77 -0
- package/src/widgets/WebPageBuilder4/SvgSetting.vue +207 -0
- package/src/widgets/WebPageBuilder4/TextSetting.vue +72 -0
- package/src/widgets/WebPageBuilder4/TextTransformSetting.vue +70 -0
- package/src/widgets/WebPageBuilder4/TreeView.vue +43 -0
- package/src/widgets/WebPageBuilder4/TreeViewItem.vue +329 -0
- package/src/widgets/WebPageBuilder4/WebPageComponentSelector.vue +147 -0
- package/src/widgets/WebPageBuilder4/WebPageDataEdit.vue +121 -0
- package/src/widgets/WebPageBuilder4/WebPagePropertySelector.vue +172 -0
- package/src/widgets/WebPageBuilder4/WidthSetting.vue +105 -0
- package/src/widgets/WebPageBuilder4/ZIndexSetting.vue +72 -0
- package/src/widgets/WebPageBuilder4.vue +1084 -0
- package/src/widgets/WebPagePreview.vue +295 -0
- package/src/widgets/WebPageSelector.vue +173 -0
- package/src/widgets/WebTemplateCreator.vue +156 -0
- package/src/widgets/YoutubeVideoSetting.vue +65 -0
- package/tailwind.config.js +513 -0
- package/test.json +22 -0
- package/public/images/mixd-logo2.png +0 -0
- package/src/components/ButtonGroup.vue +0 -101
- package/src/components/DynamicTemplate.vue +0 -44
- package/src/components/GridColumn.vue +0 -31
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp" :style="computedStyle">
|
|
3
|
+
<article ref="article" :class="$style.article"
|
|
4
|
+
v-html="computedHtml"
|
|
5
|
+
:contenteditable="editMode === 1"
|
|
6
|
+
@input="onInput"
|
|
7
|
+
@click="onClick"
|
|
8
|
+
@paste="onPaste"></article>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
|
|
14
|
+
import { componentMixin } from '../mixin/component';
|
|
15
|
+
import {getSelection, restoreSelection, saveSelection} from "../utils/selection";
|
|
16
|
+
import {applyDatasourceReplacer} from "../utils/helpers.mjs";
|
|
17
|
+
|
|
18
|
+
export default{
|
|
19
|
+
|
|
20
|
+
mixins: [ componentMixin ],
|
|
21
|
+
|
|
22
|
+
props: {
|
|
23
|
+
|
|
24
|
+
htmlText: String
|
|
25
|
+
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
methods: {
|
|
29
|
+
|
|
30
|
+
getSelection(){
|
|
31
|
+
const { text = '', href = '', target = '' } = saveSelection(this.$refs.article)
|
|
32
|
+
return {
|
|
33
|
+
text,
|
|
34
|
+
href,
|
|
35
|
+
target
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
addLink(link){
|
|
40
|
+
|
|
41
|
+
restoreSelection()
|
|
42
|
+
|
|
43
|
+
document.execCommand("insertHTML", false,
|
|
44
|
+
"<a style='font-size:inherit;font-family:inherit;background-color:inherit' " +
|
|
45
|
+
"href=\"" + link.href + "\" " +
|
|
46
|
+
"target=\"" + link.target + "\">" +
|
|
47
|
+
link.text +
|
|
48
|
+
"</a>");
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
onInput(){
|
|
52
|
+
if(this.editMode){
|
|
53
|
+
this.triggerUpdate()
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
onClick(){
|
|
58
|
+
if(this.editMode){
|
|
59
|
+
let { element } = getSelection(this.$refs.article)
|
|
60
|
+
|
|
61
|
+
const table = this.closest(element, 'table')
|
|
62
|
+
|
|
63
|
+
window.parent.postMessage({
|
|
64
|
+
uid: this.uid,
|
|
65
|
+
type: 'setSubAction',
|
|
66
|
+
value: table ? 'table' : ''
|
|
67
|
+
}, '*')
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
onPaste(e) {
|
|
72
|
+
e.preventDefault()
|
|
73
|
+
let text = (e.clipboardData || window.clipboardData).getData("text");
|
|
74
|
+
const el = document.createElement('div')
|
|
75
|
+
el.innerHTML = text
|
|
76
|
+
text = el.innerText
|
|
77
|
+
document.execCommand("insertText", false, text);
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
triggerUpdate(){
|
|
81
|
+
window.parent.postMessage({
|
|
82
|
+
uid: this.uid,
|
|
83
|
+
type: 'setProp',
|
|
84
|
+
value: {
|
|
85
|
+
htmlText: this.$refs.article.innerHTML
|
|
86
|
+
}
|
|
87
|
+
}, '*')
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
closest(el, selector){
|
|
91
|
+
let parent = el.parentNode
|
|
92
|
+
while(parent){
|
|
93
|
+
if(parent === document) break
|
|
94
|
+
|
|
95
|
+
if(parent.matches(selector)){
|
|
96
|
+
return parent
|
|
97
|
+
}
|
|
98
|
+
parent = parent.parentNode
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
addTableColumn(){
|
|
103
|
+
|
|
104
|
+
let { element } = getSelection(this.$refs.article)
|
|
105
|
+
if(element.nodeType !== 1)
|
|
106
|
+
element = element.parentNode
|
|
107
|
+
const table = this.closest(element, 'table')
|
|
108
|
+
|
|
109
|
+
if(table){
|
|
110
|
+
const thead = table.querySelector('thead')
|
|
111
|
+
const tbody = table.querySelector('tbody')
|
|
112
|
+
const tr = this.closest(element, 'tr')
|
|
113
|
+
const index = Array.from(tr.children).indexOf(element)
|
|
114
|
+
|
|
115
|
+
thead.querySelectorAll('tr').forEach(tr => {
|
|
116
|
+
const th = document.createElement('th')
|
|
117
|
+
th.innerHTML = "<i>insert header...</i>"
|
|
118
|
+
tr.insertBefore(th, tr.children[index + 1])
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
tbody.querySelectorAll('tr').forEach(tr => {
|
|
122
|
+
const td = document.createElement('td')
|
|
123
|
+
td.innerHTML = 'Content'
|
|
124
|
+
tr.insertBefore(td, tr.children[index + 1])
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
this.triggerUpdate()
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
addTableRow(){
|
|
132
|
+
|
|
133
|
+
let { element } = getSelection(this.$refs.article)
|
|
134
|
+
if(element.nodeType !== 1)
|
|
135
|
+
element = element.parentNode
|
|
136
|
+
const table = this.closest(element, 'table')
|
|
137
|
+
|
|
138
|
+
if(table){
|
|
139
|
+
const tbody = table.querySelector('tbody')
|
|
140
|
+
const tr = this.closest(element, 'tr')
|
|
141
|
+
const index = Array.from(tbody.children).indexOf(tr)
|
|
142
|
+
if(index >= 0){
|
|
143
|
+
const nTr = document.createElement('tr')
|
|
144
|
+
for(let i = 0 ; i < tr.children.length ; i++){
|
|
145
|
+
const nTd = document.createElement('td')
|
|
146
|
+
nTd.innerHTML = 'Content'
|
|
147
|
+
nTr.appendChild(nTd)
|
|
148
|
+
}
|
|
149
|
+
tbody.insertBefore(nTr, tbody.children[index + 1])
|
|
150
|
+
this.triggerUpdate()
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
removeTableRow(){
|
|
156
|
+
|
|
157
|
+
let { element } = getSelection(this.$refs.article)
|
|
158
|
+
if(element.nodeType !== 1)
|
|
159
|
+
element = element.parentNode
|
|
160
|
+
const table = this.closest(element, 'table')
|
|
161
|
+
|
|
162
|
+
if(table){
|
|
163
|
+
const tbody = table.querySelector('tbody')
|
|
164
|
+
const tr = this.closest(element, 'tr')
|
|
165
|
+
if(tr){
|
|
166
|
+
tbody.removeChild(tr)
|
|
167
|
+
this.triggerUpdate()
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
removeTableColumn(){
|
|
173
|
+
|
|
174
|
+
let { element } = getSelection(this.$refs.article)
|
|
175
|
+
if(element.nodeType !== 1)
|
|
176
|
+
element = element.parentNode
|
|
177
|
+
const table = this.closest(element, 'table')
|
|
178
|
+
|
|
179
|
+
if(table) {
|
|
180
|
+
const thead = table.querySelector('thead')
|
|
181
|
+
const tbody = table.querySelector('tbody')
|
|
182
|
+
const tr = this.closest(element, 'tr')
|
|
183
|
+
const index = Array.from(tr.children).indexOf(element)
|
|
184
|
+
|
|
185
|
+
thead.querySelectorAll('tr').forEach(tr => {
|
|
186
|
+
tr.removeChild(tr.children[index])
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
tbody.querySelectorAll('tr').forEach(tr => {
|
|
190
|
+
tr.removeChild(tr.children[index])
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
this.triggerUpdate()
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
insertTable(){
|
|
198
|
+
document.execCommand('insertHTML', false,
|
|
199
|
+
`<table>
|
|
200
|
+
<thead>
|
|
201
|
+
<tr>
|
|
202
|
+
<th>Header</th>
|
|
203
|
+
<th>Header</th>
|
|
204
|
+
</tr>
|
|
205
|
+
</thead>
|
|
206
|
+
<tbody>
|
|
207
|
+
<tr>
|
|
208
|
+
<td>Content</td>
|
|
209
|
+
<td>Content</td>
|
|
210
|
+
</tr>
|
|
211
|
+
</tbody>
|
|
212
|
+
</table>`)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
mounted() {
|
|
218
|
+
if(this.editMode){
|
|
219
|
+
window.addEventListener('message', (e) => {
|
|
220
|
+
|
|
221
|
+
const { data, source } = e
|
|
222
|
+
|
|
223
|
+
if(!data || !source) return
|
|
224
|
+
|
|
225
|
+
if(data.uid === this.uid){
|
|
226
|
+
|
|
227
|
+
const { action, type, value } = data.data ?? {}
|
|
228
|
+
|
|
229
|
+
let result
|
|
230
|
+
|
|
231
|
+
switch(action){
|
|
232
|
+
|
|
233
|
+
case 'saveSelection':
|
|
234
|
+
case 'getSelection':
|
|
235
|
+
const sel = saveSelection(this.$refs.article)
|
|
236
|
+
const { text, target, href } = sel
|
|
237
|
+
result = {
|
|
238
|
+
text,
|
|
239
|
+
target,
|
|
240
|
+
href
|
|
241
|
+
}
|
|
242
|
+
break
|
|
243
|
+
|
|
244
|
+
case 'restoreSelection':
|
|
245
|
+
restoreSelection()
|
|
246
|
+
break
|
|
247
|
+
|
|
248
|
+
case 'insertLink':
|
|
249
|
+
restoreSelection()
|
|
250
|
+
|
|
251
|
+
document.execCommand("insertHTML", false,
|
|
252
|
+
"<a style='font-size:inherit;font-family:inherit;background-color:inherit' " +
|
|
253
|
+
"href=\"" + value.href + "\" " +
|
|
254
|
+
"target=\"" + value.target + "\">" +
|
|
255
|
+
value.text +
|
|
256
|
+
"</a>");
|
|
257
|
+
break
|
|
258
|
+
|
|
259
|
+
case 'removeLink':
|
|
260
|
+
const { element } = getSelection(this.$refs.article)
|
|
261
|
+
|
|
262
|
+
let a = element
|
|
263
|
+
while(a && a.tagName !== 'A'){
|
|
264
|
+
a = a.parentNode
|
|
265
|
+
}
|
|
266
|
+
if(a){
|
|
267
|
+
a.parentNode.replaceChild(element, a)
|
|
268
|
+
}
|
|
269
|
+
break
|
|
270
|
+
|
|
271
|
+
case 'insertImage':
|
|
272
|
+
const props = {}
|
|
273
|
+
if(value.width)
|
|
274
|
+
props.width = parseInt(value.width) + 'px'
|
|
275
|
+
if(value.height)
|
|
276
|
+
props.height = parseInt(value.height) + 'px'
|
|
277
|
+
|
|
278
|
+
let propHtml = []
|
|
279
|
+
for(let key in props){
|
|
280
|
+
propHtml.push(`${key}='${props[key]}'`)
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
document.execCommand("insertHTML", false,
|
|
284
|
+
"<img src=\"" + value.url + "\" " + propHtml.join(' ') + "/>");
|
|
285
|
+
break
|
|
286
|
+
|
|
287
|
+
case 'insertTable':
|
|
288
|
+
this.insertTable()
|
|
289
|
+
break
|
|
290
|
+
|
|
291
|
+
case 'removeFormat':
|
|
292
|
+
document.execCommand('removeFormat', false);
|
|
293
|
+
break
|
|
294
|
+
|
|
295
|
+
case 'addTableColumn':
|
|
296
|
+
this.addTableColumn()
|
|
297
|
+
break
|
|
298
|
+
|
|
299
|
+
case 'addTableRow':
|
|
300
|
+
this.addTableRow()
|
|
301
|
+
break
|
|
302
|
+
|
|
303
|
+
case 'removeTableColumn':
|
|
304
|
+
this.removeTableColumn()
|
|
305
|
+
break
|
|
306
|
+
|
|
307
|
+
case 'removeTableRow':
|
|
308
|
+
this.removeTableRow()
|
|
309
|
+
break
|
|
310
|
+
|
|
311
|
+
case 'format':
|
|
312
|
+
switch(type){
|
|
313
|
+
case 'bold':
|
|
314
|
+
case 'italic':
|
|
315
|
+
default:
|
|
316
|
+
document.execCommand(type, false, value);
|
|
317
|
+
break
|
|
318
|
+
}
|
|
319
|
+
this.$refs.article.focus()
|
|
320
|
+
break
|
|
321
|
+
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
source.postMessage(result, '*')
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
})
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
|
|
331
|
+
computed: {
|
|
332
|
+
|
|
333
|
+
computedHtml(){
|
|
334
|
+
if(this.editMode && this.editMode === 1)
|
|
335
|
+
return this.htmlText
|
|
336
|
+
return applyDatasourceReplacer(this.htmlText, this.pageData)
|
|
337
|
+
},
|
|
338
|
+
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
data(){
|
|
342
|
+
return {
|
|
343
|
+
data: {},
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
</script>
|
|
350
|
+
|
|
351
|
+
<style module>
|
|
352
|
+
|
|
353
|
+
.comp{
|
|
354
|
+
@apply relative;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.article{
|
|
358
|
+
}
|
|
359
|
+
.article *{
|
|
360
|
+
}
|
|
361
|
+
.article[contenteditable]{
|
|
362
|
+
@apply outline-none;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.article a{
|
|
366
|
+
@apply text-primary underline;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.article ul li{
|
|
370
|
+
@apply list-disc list-inside;
|
|
371
|
+
}
|
|
372
|
+
.article ol li{
|
|
373
|
+
@apply list-decimal list-inside;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.article font[size='1']{ @apply text-xs; }
|
|
377
|
+
.article font[size='2']{ @apply text-sm; }
|
|
378
|
+
.article font[size='3']{ @apply text-lg; }
|
|
379
|
+
.article font[size='4']{ @apply text-xl; }
|
|
380
|
+
.article font[size='5']{ @apply text-2xl; }
|
|
381
|
+
.article font[size='6']{ @apply text-3xl; }
|
|
382
|
+
.article font[size='7']{ @apply text-4xl; }
|
|
383
|
+
|
|
384
|
+
.article table{
|
|
385
|
+
@apply border-[1px] border-text-200 border-collapse w-full;
|
|
386
|
+
table-layout: fixed;
|
|
387
|
+
}
|
|
388
|
+
.article table th, .article table td{
|
|
389
|
+
@apply border-[1px] border-text-200 p-3 text-left;
|
|
390
|
+
@apply break-words;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
</style>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp" :style="computedStyle">
|
|
3
|
+
<component v-for="item in items"
|
|
4
|
+
:is="item.type"
|
|
5
|
+
:="item" />
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
|
|
11
|
+
import {componentMixin} from "../mixin/component";
|
|
12
|
+
|
|
13
|
+
export default{
|
|
14
|
+
|
|
15
|
+
mixins: [ componentMixin ],
|
|
16
|
+
|
|
17
|
+
props:{
|
|
18
|
+
items: Array,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<style module>
|
|
26
|
+
|
|
27
|
+
.comp{
|
|
28
|
+
@apply block;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.comp">
|
|
3
|
+
<br />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
|
|
9
|
+
import { componentMixin } from '../mixin/component';
|
|
10
|
+
|
|
11
|
+
export default{
|
|
12
|
+
|
|
13
|
+
mixins: [ componentMixin ],
|
|
14
|
+
|
|
15
|
+
props: {
|
|
16
|
+
|
|
17
|
+
title: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: 'Box'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<style module>
|
|
29
|
+
|
|
30
|
+
.comp{
|
|
31
|
+
@apply flex items-center justify-center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
</style>
|