diff --git a/app/Views/layouts/admin/left_menu.php b/app/Views/layouts/admin/left_menu.php
index d63aba4..918ed83 100644
--- a/app/Views/layouts/admin/left_menu.php
+++ b/app/Views/layouts/admin/left_menu.php
@@ -1,6 +1,6 @@
-
+
= $this->include($viewDatas['layout']['path'] . '/left_menu/base'); ?>
diff --git a/app/Views/templates/admin/footer.php b/app/Views/templates/admin/footer.php
index 4323c69..a3ffb9c 100644
--- a/app/Views/templates/admin/footer.php
+++ b/app/Views/templates/admin/footer.php
@@ -25,12 +25,40 @@
$(".select-field").select2({
theme: "bootstrap-5",
});
- //class가 editor인 textarea용
+ // text editor 초기화
+ //참고: https://phppot.com/menu/php/learn-php/
+ // class가 editor인 textarea용
tinymce.init({
selector: 'textarea.editor',
- plugins: 'code',
+ plugins: ['code', 'image'],
+ toolbar: 'image',
height: 600,
- content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }'
+ // content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }'
+ automatic_uploads: false,
+ images_upload_url: '/tinymce_upload.php',
+ // images_upload_base_path: '/upload_images',
+ images_upload_handler: function(blobInfo, success, failure) {
+ var xhr, formData;
+ xhr = new XMLHttpRequest();
+ xhr.withCredentials = false;
+ xhr.open('POST', '/tinymce_upload.php');
+ xhr.onload = function() {
+ var json;
+ if (xhr.status != 200) {
+ failure('HTTP Error: ' + xhr.status);
+ return;
+ }
+ json = JSON.parse(xhr.responseText);
+ if (!json || typeof json.file_path != 'string') {
+ failure('Invalid JSON: ' + xhr.responseText);
+ return;
+ }
+ success(json.file_path);
+ };
+ formData = new FormData();
+ formData.append('file', blobInfo.blob(), blobInfo.filename());
+ xhr.send(formData);
+ },
});
});
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 11fa52c..e06c228 100644
--- a/composer.json
+++ b/composer.json
@@ -12,7 +12,7 @@
"twbs/bootstrap": "5.2.3",
"guzzlehttp/guzzle": "^7.7",
"google/apiclient": "2.12.1",
- "tinymce/tinymce": "^6.6"
+ "tinymce/tinymce": "^7.1"
},
"require-dev": {
"fakerphp/faker": "^1.9",
diff --git a/public/tinymce_upload.php b/public/tinymce_upload.php
new file mode 100644
index 0000000..99c96fe
--- /dev/null
+++ b/public/tinymce_upload.php
@@ -0,0 +1,32 @@
+ $fileName
+ ));
+}