21
21
</template >
22
22
23
23
<script setup>
24
- import { computed , ref } from " vue"
24
+ import { computed , ref , watch } from " vue"
25
25
import TinyEditor from " ../../components/Editor"
26
26
import { useRoute , useRouter } from " vue-router"
27
27
import { useCidReqStore } from " ../../store/cidReq"
28
28
import { storeToRefs } from " pinia"
29
29
import { useSecurityStore } from " ../../store/securityStore"
30
30
import FloatLabel from " primevue/floatlabel"
31
31
32
- // import contentUiCss from "css-loader!tinymce/skins/ui/oxide/content.css"
33
- // import contentCss from "css-loader!tinymce/skins/content/default/content.css"
34
-
35
32
const modelValue = defineModel ({
36
33
type: String ,
37
34
required: true ,
@@ -104,7 +101,6 @@ const toolbarTextDirection = "ltr rtl"
104
101
const defaultEditorConfig = {
105
102
skin: false ,
106
103
content_css: false ,
107
- // content_style: contentUiCss.toString() + "\n" + contentCss.toString(),
108
104
branding: false ,
109
105
relative_urls: false ,
110
106
height: 500 ,
@@ -136,33 +132,30 @@ const defaultEditorConfig = {
136
132
" visualblocks" ,
137
133
" wordcount" ,
138
134
],
139
- toolbar:
140
- toolbarUndo +
141
- " | " +
142
- toolbarFormatText +
143
- " | " +
144
- toolbarInsertMedia +
145
- " | " +
146
- toolbarFontConfig +
147
- " | " +
148
- toolbarAlign +
149
- " | " +
150
- toolbarIndent +
151
- " | " +
152
- toolbarList +
153
- " | " +
154
- toolbarColor +
155
- " | " +
156
- toolbarPageBreak +
157
- " | " +
158
- toolbarSpecialSymbols +
159
- " | " +
160
- toolbarOther +
161
- " | " +
162
- toolbarCode +
163
- " | " +
164
- toolbarTextDirection,
135
+ toolbar: [
136
+ toolbarUndo,
137
+ toolbarFormatText,
138
+ toolbarInsertMedia,
139
+ toolbarFontConfig,
140
+ toolbarAlign,
141
+ toolbarIndent,
142
+ toolbarList,
143
+ toolbarColor,
144
+ toolbarPageBreak,
145
+ toolbarSpecialSymbols,
146
+ toolbarOther,
147
+ toolbarCode,
148
+ toolbarTextDirection
149
+ ].join (" | " ),
165
150
file_picker_callback: filePickerCallback,
151
+ content_style: " .tiny-content { font-family: Arial, sans-serif; font-size: 14px; }" ,
152
+ body_class: ' tiny-content' ,
153
+ setup : (editor ) => {
154
+ editor .on (' init' , () => {
155
+ const body = editor .getBody ();
156
+ body .classList .add (' tiny-content' );
157
+ });
158
+ }
166
159
}
167
160
168
161
if (props .fullPage ) {
@@ -175,6 +168,12 @@ const editorConfig = computed(() => ({
175
168
... props .editorConfig ,
176
169
}))
177
170
171
+ watch (modelValue, (newValue ) => {
172
+ if (newValue && ! newValue .includes (' tiny-content' )) {
173
+ modelValue .value = ` <div class="tiny-content">${ newValue} </div>`
174
+ }
175
+ })
176
+
178
177
async function filePickerCallback (callback , value , meta ) {
179
178
let url = getUrlForTinyEditor ()
180
179
if (" image" === meta .filetype ) {
0 commit comments