Skip to content

Commit f59682b

Browse files
authored
Merge pull request #2190 from opensource-workshop/dev/tinymce
[JSライブラリ][WYSIWYG][テーマ管理] TinyMCEを6→7へアップデート OW-2523
2 parents e0f5186 + e66d1c5 commit f59682b

File tree

12 files changed

+61
-68
lines changed

12 files changed

+61
-68
lines changed

app/Plugins/Manage/ThemeManage/ThemeManage.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function declareRole()
3232
$role_ckeck_table["create"] = array('admin_site');
3333
$role_ckeck_table["editCss"] = array('admin_site');
3434
$role_ckeck_table["saveCss"] = array('admin_site');
35-
$role_ckeck_table["editTemplate"] = array('admin_site');
35+
// $role_ckeck_table["editTemplate"] = array('admin_site');
3636
$role_ckeck_table["saveTemplate"] = array('admin_site');
3737
$role_ckeck_table["editJs"] = array('admin_site');
3838
$role_ckeck_table["saveJs"] = array('admin_site');
@@ -386,13 +386,15 @@ public function saveCss($request, $id)
386386
]);
387387
}
388388

389+
// delete: tinymce7対応. template はTinyMCE 7.xのオープンソース版から削除されてPremium版に移りました
389390
/**
390391
* テンプレート編集画面
391392
*
392-
* @method_title テンプレート編集
393-
* @method_desc ユーザ・テーマ毎のテンプレートを画面で編集できます。
394-
* @method_detail 保存したテンプレートは選択したテーマで反映されます。
393+
* method_title テンプレート編集
394+
* method_desc ユーザ・テーマ毎のテンプレートを画面で編集できます。
395+
* method_detail 保存したテンプレートは選択したテーマで反映されます。
395396
*/
397+
/*
396398
public function editTemplate($request, $id)
397399
{
398400
// httpメソッド確認
@@ -426,6 +428,7 @@ public function editTemplate($request, $id)
426428
"template" => $template,
427429
]);
428430
}
431+
*/
429432

430433
/**
431434
* テンプレート保存画面

package-lock.json

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"sass": "^1.62.1",
3131
"sass-loader": "^12.6.0",
3232
"sortablejs": "^1.15.2",
33-
"tinymce": "^6.8.5",
33+
"tinymce": "^7.8.0",
3434
"vue": "^3.5.13",
3535
"vue-loader": "^17.3.0"
3636
}

public/js/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/app.js.LICENSE.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
/*! #__NO_SIDE_EFFECTS__ */
3232

33+
/*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE */
34+
3335
/*! Axios v1.9.0 Copyright (c) 2025 Matt Zabriskie and contributors */
3436

3537
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */

public/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"/js/app.js": "/js/app.js?id=4b33b4976170adce391d1d910fc9d34f",
2+
"/js/app.js": "/js/app.js?id=39c1043952d314598bdcb00c1817d397",
33
"/css/app.css": "/css/app.css?id=94110667e125790f9646ca8f0c9d2382"
44
}

resources/js/bootstrap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ dayjs.extend(timezone);
9393
window.dayjs = dayjs;
9494

9595
// --- TinyMCE
96-
// 「Example src/editor.js」よりコピーして編集: https://www.tiny.cloud/docs/tinymce/6/vite-es6-npm/#procedures
96+
// 「Example src/editor.js」よりコピーして編集: https://www.tiny.cloud/docs/tinymce/latest/vite-es6-npm/#procedures
9797
/* Import TinyMCE */
9898
import tinymce from 'tinymce';
9999
window.tinymce = tinymce;
@@ -109,7 +109,8 @@ import 'tinymce/models/dom';
109109
import 'tinymce/skins/ui/oxide/skin.js';
110110

111111
/* Import plugins */
112-
// delete: imagetools はTinyMCE 6.0のオープンソース版で削除されました
112+
// delete: imagetools はTinyMCE 6.xのオープンソース版から削除されてPremium版に移りました
113+
// delete: template はTinyMCE 7.xのオープンソース版から削除されてPremium版に移りました
113114
import 'tinymce/plugins/advlist';
114115
import 'tinymce/plugins/code';
115116
import 'tinymce/plugins/link';
@@ -118,7 +119,6 @@ import 'tinymce/plugins/table';
118119
import 'tinymce/plugins/media';
119120
import 'tinymce/plugins/autolink';
120121
import 'tinymce/plugins/preview';
121-
import 'tinymce/plugins/template';
122122

123123
/* Import plugins(Connect-CMS Custom)
124124
コピー元Path: node_modules/tinymce/plugins/image/plugin.js */

resources/js/tinymce/langs/ja.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/tinymce/plugins/image/plugin.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* TinyMCE version 6.8.5 (TBD)
2+
* TinyMCE version 7.8.0 (TBD)
33
*/
44

55
(function () {
@@ -322,24 +322,23 @@
322322
const getImageSize = url => new Promise(callback => {
323323
const img = document.createElement('img');
324324
const done = dimensions => {
325-
img.onload = img.onerror = null;
326325
if (img.parentNode) {
327326
img.parentNode.removeChild(img);
328327
}
329328
callback(dimensions);
330329
};
331-
img.onload = () => {
330+
img.addEventListener('load', () => {
332331
const width = parseIntAndGetMax(img.width, img.clientWidth);
333332
const height = parseIntAndGetMax(img.height, img.clientHeight);
334333
const dimensions = {
335334
width,
336335
height
337336
};
338337
done(Promise.resolve(dimensions));
339-
};
340-
img.onerror = () => {
338+
});
339+
img.addEventListener('error', () => {
341340
done(Promise.reject(`Failed to get image dimensions for: ${ url }`));
342-
};
341+
});
343342
const style = img.style;
344343
style.visibility = 'hidden';
345344
style.position = 'fixed';
@@ -742,6 +741,7 @@
742741
write(css => normalizeCss$1(editor, css), data, image);
743742
syncSrcAttr(editor, image);
744743
if (isFigure(image.parentNode)) {
744+
editor.dom.setStyle(image, 'float', '');
745745
const figure = image.parentNode;
746746
splitTextBlock(editor, figure);
747747
editor.selection.select(image.parentNode);
@@ -1321,6 +1321,7 @@
13211321
});
13221322
api.showTab('general');
13231323
changeSrc(helpers, info, state, api);
1324+
api.focus('src');
13241325
};
13251326
blobToDataUri(file).then(dataUrl => {
13261327
const blobInfo = helpers.createBlobCache(file, blobUri, dataUrl);
@@ -1330,7 +1331,9 @@
13301331
finalize();
13311332
}).catch(err => {
13321333
finalize();
1333-
helpers.alertErr(err);
1334+
helpers.alertErr(err, () => {
1335+
api.focus('fileinput');
1336+
});
13341337
});
13351338
} else {
13361339
helpers.addToBlobCache(blobInfo);
@@ -1413,8 +1416,8 @@
14131416
const addToBlobCache = editor => blobInfo => {
14141417
editor.editorUpload.blobCache.add(blobInfo);
14151418
};
1416-
const alertErr = editor => message => {
1417-
editor.windowManager.alert(message);
1419+
const alertErr = editor => (message, callback) => {
1420+
editor.windowManager.alert(message, callback);
14181421
};
14191422
const normalizeCss = editor => cssText => normalizeCss$1(editor, cssText);
14201423
const parseStyle = editor => cssText => editor.dom.parseStyle(cssText);

resources/views/plugins/common/wysiwyg.blade.php

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -143,21 +143,6 @@
143143
$advlist_number_lists_file = File::get($advlist_number_lists_default_path);
144144
}
145145
146-
// テーマ固有 簡易テンプレート
147-
$templates_file = '';
148-
$templates_path = public_path() . '/themes/' . $theme . '/wysiwyg/templates.txt';
149-
$templates_group_default_path = public_path() . '/themes/' . $theme_group_default . '/wysiwyg/templates.txt';
150-
$templates_default_path = public_path() . '/themes/Defaults/Default/wysiwyg/templates.txt';
151-
if (File::exists($templates_path)) {
152-
$templates_file = File::get($templates_path);
153-
}
154-
else if (File::exists($templates_group_default_path)) {
155-
$templates_file = File::get($templates_group_default_path);
156-
}
157-
else if (File::exists($templates_default_path)) {
158-
$templates_file = File::get($templates_default_path);
159-
}
160-
161146
// TinyMCE Body クラス
162147
$body_class = '';
163148
if ($frame->area_id == 0) {
@@ -180,7 +165,8 @@
180165
// change: tinymce5対応. textcolor は coreに含まれたため除外
181166
// change: tinymce6対応. imagetools は オープンソース版から削除のため除外
182167
// change: tinymce6対応. hr は coreに含まれたため除外
183-
$plugins = 'file image media link autolink preview code table lists advlist template ';
168+
// change: tinymce7対応. template は オープンソース版から削除のため除外
169+
$plugins = 'file image media link autolink preview code table lists advlist ';
184170
if (Configs::getConfigsValue($cc_configs, 'use_translate', UseType::not_use) == UseType::use) {
185171
$plugins .= ' translate';
186172
}
@@ -203,11 +189,6 @@
203189
// toolbar
204190
$toolbar = "undo redo | bold italic underline strikethrough subscript superscript {$toolbar_fontsizeselect} | styles | forecolor backcolor | removeformat | table hr | numlist bullist | blockquote | alignleft aligncenter alignright alignjustify | outdent indent | link | image file media | preview | code";
205191
$mobile_toolbar = "undo redo | image file media | link | code | bold italic underline strikethrough subscript superscript {$toolbar_fontsizeselect} | styles | forecolor backcolor | removeformat | table hr | numlist bullist | blockquote | alignleft aligncenter alignright alignjustify | outdent indent | preview";
206-
// 簡易テンプレート設定がない場合、テンプレート挿入ボタン押下でエラー出るため、設定ない場合はボタン表示しない。
207-
if (! empty($templates_file)) {
208-
$toolbar .= '| template ';
209-
$mobile_toolbar .= '| template ';
210-
}
211192
// いずれかの外部サービスONの場合、頭に区切り文字 | を追加する
212193
if (Configs::getConfigsValue($cc_configs, 'use_translate', UseType::not_use) == UseType::use || Configs::getConfigsValue($cc_configs, 'use_pdf_thumbnail')) {
213194
$toolbar .= ' | ';
@@ -269,11 +250,16 @@
269250
selector : 'textarea',
270251
@endif
271252
272-
cache_suffix: '?v=6.1',
253+
cache_suffix: '?v=7.1',
273254
274255
// add: tinymce6対応. www.tiny.cloudのPRリンク表示OFF
256+
// see) https://www.tiny.cloud/docs/tinymce/latest/promotions/
275257
promotion: false,
276258
259+
// add: tinymce7対応. ライセンスの設定
260+
// see) https://www.tiny.cloud/docs/tinymce/latest/license-key/
261+
license_key: 'gpl',
262+
277263
// change: app.blade.phpと同様にlocaleを見て切替
278264
language : '{{ app()->getLocale() }}',
279265
@@ -312,9 +298,6 @@
312298
{{-- テーマ固有 番号箇条書きリスト(OLタグ)の表示設定 --}}
313299
{!!$advlist_number_lists_file!!}
314300
315-
{{-- テーマ固有 簡易テンプレート設定 --}}
316-
{!!$templates_file!!}
317-
318301
formats: {
319302
// bugfix: bootstrap4のblockquoteはclassに'blockquote'付ける
320303
blockquote: { block: 'blockquote', classes: 'blockquote' }
@@ -333,7 +316,7 @@
333316
},
334317
335318
relative_urls : false,
336-
height: {{ isset($height) ? $height : 300 }},
319+
height: {{ isset($height) ? $height : 400 }},
337320
resize: 'both',
338321
branding: false,
339322
valid_children : "+body[style|input],+a[div|p],",

0 commit comments

Comments
 (0)