diff --git a/src/views/contents/ContentEditorPage.vue b/src/views/contents/ContentEditorPage.vue index af0bbdf..da52af7 100644 --- a/src/views/contents/ContentEditorPage.vue +++ b/src/views/contents/ContentEditorPage.vue @@ -18,6 +18,7 @@ const isSnackbarOpen = ref(false); const snackbarTimeout = ref(2000); const snackbarText = ref(''); const snackbarColor = ref('red'); +const selectedBackgroundColor = ref('#f0f0f0'); const userStore = useUserProfileStore(); @@ -81,6 +82,13 @@ const saveAsync = async () => { ${title.value} + ${content.value} @@ -103,6 +111,47 @@ const saveAsync = async () => { } }; +const setupTinyMCE = (editor) => { + // Custom button for selecting background color + editor.ui.registry.addButton('myCustomBgColorButton', { + text: 'Page BG Color', + onAction: function () { + editor.windowManager.open({ + title: 'Select Page Background Color', + body: { + type: 'panel', + items: [ + { + type: 'colorpicker', + name: 'colorpicker', + label: 'Background Color' + } + ] + }, + buttons: [ + { + text: 'Save', + type: 'submit', + primary: true + } + ], + onSubmit: function (dialog) { + console.log('supppp'); + const color = dialog.getData().colorpicker; + console.log(color); + selectedBackgroundColor.value = color; + + // Insert style into TinyMCE's content + const styleTag = ``; + editor.execCommand('mceInsertContent', false, styleTag); + + dialog.close(); // Close dialog after selecting color + } + }); + } + }); +} +