@burger-editor/local 4.0.0-alpha.54 → 4.0.0-alpha.55
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/dist/client.js +443 -260
- package/dist/client.js.map +1 -1
- package/dist/local.css +8 -2
- package/package.json +7 -7
package/dist/client.js
CHANGED
|
@@ -866,7 +866,7 @@ TurndownService.prototype = {
|
|
|
866
866
|
|
|
867
867
|
if (input === '') return ''
|
|
868
868
|
|
|
869
|
-
var output = process.call(this, new RootNode(input, this.options));
|
|
869
|
+
var output = process$1.call(this, new RootNode(input, this.options));
|
|
870
870
|
return postProcess.call(this, output)
|
|
871
871
|
},
|
|
872
872
|
|
|
@@ -952,7 +952,7 @@ TurndownService.prototype = {
|
|
|
952
952
|
* @type String
|
|
953
953
|
*/
|
|
954
954
|
|
|
955
|
-
function process (parentNode) {
|
|
955
|
+
function process$1 (parentNode) {
|
|
956
956
|
var self = this;
|
|
957
957
|
return reduce.call(parentNode.childNodes, function (output, node) {
|
|
958
958
|
node = new Node$2(node, self.options);
|
|
@@ -997,7 +997,7 @@ function postProcess (output) {
|
|
|
997
997
|
|
|
998
998
|
function replacementForNode (node) {
|
|
999
999
|
var rule = this.rules.forNode(node);
|
|
1000
|
-
var content = process.call(this, node);
|
|
1000
|
+
var content = process$1.call(this, node);
|
|
1001
1001
|
var whitespace = node.flankingWhitespace;
|
|
1002
1002
|
if (whitespace.leading || whitespace.trailing) content = content.trim();
|
|
1003
1003
|
return (
|
|
@@ -1296,7 +1296,7 @@ var style$b = "/* No Styling */\n";
|
|
|
1296
1296
|
var template$b = "<a href=\"\" data-kind=\"primary\" data-before-icon=\"none\" data-after-icon=\"none\" data-bge=\"link:href, target:target, kind:data-kind, before-icon:data-before-icon, after-icon:data-after-icon\">\n\t<div>\n\t\t<span data-bge=\"text\">ボタン</span>\n\t\t<span data-bge=\"subtext\">サブテキスト</span>\n\t</div>\n</a>\n";
|
|
1297
1297
|
|
|
1298
1298
|
var button = createItem$1({
|
|
1299
|
-
version: "4.0.0-alpha.
|
|
1299
|
+
version: "4.0.0-alpha.54",
|
|
1300
1300
|
name: "button",
|
|
1301
1301
|
template: template$b,
|
|
1302
1302
|
style: style$b,
|
|
@@ -1352,7 +1352,7 @@ var style$a = "/* No Styling */\n";
|
|
|
1352
1352
|
var template$a = "<details data-bge=\"open:open\">\n\t<summary data-bge=\"summary\">折りたたみコンテンツ</summary>\n\t<div data-bge=\"content\"><p>内容を入力してください</p></div>\n</details>\n";
|
|
1353
1353
|
|
|
1354
1354
|
var details = createItem$1({
|
|
1355
|
-
version: "4.0.0-alpha.
|
|
1355
|
+
version: "4.0.0-alpha.54",
|
|
1356
1356
|
name: "details",
|
|
1357
1357
|
template: template$a,
|
|
1358
1358
|
style: style$a,
|
|
@@ -1366,7 +1366,7 @@ var style$9 = "[data-bgi='download-file'] {\n\t[data-bge*='size'] {\n\t\t&::befo
|
|
|
1366
1366
|
var template$9 = "<a href=\"./files/bgeditor/bg-sample.pdf\" target=\"_blank\" data-bge=\"path:href, download:download\">\n\t<div>\n\t\t<span data-bge=\"name\">サンプルダウンロードファイル</span>\n\t\t<span data-bge=\"formated-size, size:data-size\" data-size=\"138158\">134.92kB</span>\n\t</div>\n</a>\n";
|
|
1367
1367
|
|
|
1368
1368
|
var downloadFile = createItem$1({
|
|
1369
|
-
version: "4.0.0-alpha.
|
|
1369
|
+
version: "4.0.0-alpha.54",
|
|
1370
1370
|
name: "download-file",
|
|
1371
1371
|
template: template$9,
|
|
1372
1372
|
style: style$9,
|
|
@@ -1405,7 +1405,7 @@ var style$8 = "[data-bgi='google-maps'] {\n\tdiv {\n\t\tinline-size: 100%;\n\t\t
|
|
|
1405
1405
|
var template$8 = "<div data-lat=\"35.681382\" data-lng=\"139.766084\" data-zoom=\"16\" data-bge=\"lat:data-lat, lng:data-lng, zoom:data-zoom\">\n\t<img data-bge=\"img:src\" src=\"https://maps.google.com/maps/api/staticmap?center=35.681382,139.766084&zoom=16&size=640x400&markers=color:red|color:red|35.681382,139.766084&scale=2&key=%googleMapsApiKey%\" width=\"8\" height=\"5\" alt=\"Google Maps\" />\n</div>\n<a href=\"https://maps.apple.com/?q=35.681382,139.766084\" data-bge=\"url:href\" target=\"_blank\"><span>アプリで開く</span></a>\n";
|
|
1406
1406
|
|
|
1407
1407
|
var googleMaps = createItem$1({
|
|
1408
|
-
version: "4.0.0-alpha.
|
|
1408
|
+
version: "4.0.0-alpha.54",
|
|
1409
1409
|
name: "google-maps",
|
|
1410
1410
|
template: template$8,
|
|
1411
1411
|
style: style$8,
|
|
@@ -1540,7 +1540,7 @@ var style$7 = "[data-bgi='hr'] {\n\t--inline-size: 100%;\n\t--border-color: #000
|
|
|
1540
1540
|
var template$7 = "<div data-bgi-hr-kind=\"primary\" data-bge=\"kind:data-bgi-hr-kind\">\n\t<hr />\n</div>\n";
|
|
1541
1541
|
|
|
1542
1542
|
var hr = createItem$1({
|
|
1543
|
-
version: "4.0.0-alpha.
|
|
1543
|
+
version: "4.0.0-alpha.54",
|
|
1544
1544
|
name: "hr",
|
|
1545
1545
|
template: template$7,
|
|
1546
1546
|
style: style$7,
|
|
@@ -1630,7 +1630,7 @@ function createWidthState() {
|
|
|
1630
1630
|
|
|
1631
1631
|
const ORIGIN = "__org";
|
|
1632
1632
|
var image = createItem$1({
|
|
1633
|
-
version: "4.0.0-alpha.
|
|
1633
|
+
version: "4.0.0-alpha.54",
|
|
1634
1634
|
name: "image",
|
|
1635
1635
|
template: template$6,
|
|
1636
1636
|
style: style$6,
|
|
@@ -1828,7 +1828,7 @@ var style$5 = "[data-bgi='import'] {\n\tbge-import {\n\t\t&::before {\n\t\t\tfon
|
|
|
1828
1828
|
var template$5 = "<bge-import data-bge=\":src\" src=\"\"></bge-import>\n";
|
|
1829
1829
|
|
|
1830
1830
|
var importItem = createItem$1({
|
|
1831
|
-
version: "4.0.0-alpha.
|
|
1831
|
+
version: "4.0.0-alpha.54",
|
|
1832
1832
|
name: "import",
|
|
1833
1833
|
template: template$5,
|
|
1834
1834
|
style: style$5,
|
|
@@ -1842,7 +1842,7 @@ var style$4 = "/* No Styling */\n";
|
|
|
1842
1842
|
var template$4 = "<div data-bge=\":scrollable\" data-bge-scrollable=\"false\">\n\t<table>\n\t\t<caption data-bge=\"caption\">\n\t\t\tキャプションを入力してください\n\t\t</caption>\n\t\t<tbody data-bge-list>\n\t\t\t<tr>\n\t\t\t\t<th data-bge=\"th\">表組の見出し</th>\n\t\t\t\t<td data-bge=\"td\">表組の内容を入力してください</td>\n\t\t\t</tr>\n\t\t</tbody>\n\t</table>\n</div>\n";
|
|
1843
1843
|
|
|
1844
1844
|
var table = createItem$1({
|
|
1845
|
-
version: "4.0.0-alpha.
|
|
1845
|
+
version: "4.0.0-alpha.54",
|
|
1846
1846
|
name: "table",
|
|
1847
1847
|
template: template$4,
|
|
1848
1848
|
style: style$4,
|
|
@@ -1870,7 +1870,7 @@ var style$3 = "/* No Styling */\n";
|
|
|
1870
1870
|
var template$3 = "<h2 data-bge=\"title-h2\">見出しを入力してください</h2>\n";
|
|
1871
1871
|
|
|
1872
1872
|
var titleH2 = createItem$1({
|
|
1873
|
-
version: "4.0.0-alpha.
|
|
1873
|
+
version: "4.0.0-alpha.54",
|
|
1874
1874
|
name: "title-h2",
|
|
1875
1875
|
template: template$3,
|
|
1876
1876
|
style: style$3,
|
|
@@ -1884,7 +1884,7 @@ var style$2 = "/* No Styling */\n";
|
|
|
1884
1884
|
var template$2 = "<h3 data-bge=\"title-h3\">見出しを入力してください</h3>\n";
|
|
1885
1885
|
|
|
1886
1886
|
var titleH3 = createItem$1({
|
|
1887
|
-
version: "4.0.0-alpha.
|
|
1887
|
+
version: "4.0.0-alpha.54",
|
|
1888
1888
|
name: "title-h3",
|
|
1889
1889
|
template: template$2,
|
|
1890
1890
|
style: style$2,
|
|
@@ -1898,7 +1898,7 @@ var style$1 = "/* No Styling */\n";
|
|
|
1898
1898
|
var template$1 = "<div data-bge=\"wysiwyg\"><p>本文を入力してください</p></div>\n";
|
|
1899
1899
|
|
|
1900
1900
|
var wysiwyg = createItem$1({
|
|
1901
|
-
version: "4.0.0-alpha.
|
|
1901
|
+
version: "4.0.0-alpha.54",
|
|
1902
1902
|
name: "wysiwyg",
|
|
1903
1903
|
template: template$1,
|
|
1904
1904
|
style: style$1,
|
|
@@ -1913,7 +1913,7 @@ var template = "<div data-id=\"3KtWfp0UopM\" data-title=\"YouTube動画\" data-w
|
|
|
1913
1913
|
|
|
1914
1914
|
const FALLBACK_TITLE = "YouTube\u52D5\u753B";
|
|
1915
1915
|
var youtube = createItem$1({
|
|
1916
|
-
version: "4.0.0-alpha.
|
|
1916
|
+
version: "4.0.0-alpha.54",
|
|
1917
1917
|
name: "youtube",
|
|
1918
1918
|
template,
|
|
1919
1919
|
style: style$c,
|
|
@@ -7015,7 +7015,8 @@ class BurgerEditorEngine {
|
|
|
7015
7015
|
engine.save();
|
|
7016
7016
|
if (options.defineCustomElement) {
|
|
7017
7017
|
await options.defineCustomElement({
|
|
7018
|
-
className: options.config.classList.join(" ")
|
|
7018
|
+
className: options.config.classList.join(" "),
|
|
7019
|
+
experimental: options.config.experimental
|
|
7019
7020
|
});
|
|
7020
7021
|
}
|
|
7021
7022
|
engine.#healthMonitor.start();
|
|
@@ -32655,6 +32656,111 @@ function createElement(options, global = window) {
|
|
|
32655
32656
|
}
|
|
32656
32657
|
return wrapperElement;
|
|
32657
32658
|
}
|
|
32659
|
+
function getCurrentEditorState(wysiwygElement) {
|
|
32660
|
+
const editor = wysiwygElement.editor;
|
|
32661
|
+
if (!editor) {
|
|
32662
|
+
throw new ReferenceError("TipTap editor is not initialized");
|
|
32663
|
+
}
|
|
32664
|
+
return {
|
|
32665
|
+
bold: {
|
|
32666
|
+
disabled: !editor.can().chain().focus().toggleBold().run(),
|
|
32667
|
+
active: editor.isActive("bold")
|
|
32668
|
+
},
|
|
32669
|
+
italic: {
|
|
32670
|
+
disabled: !editor.can().chain().focus().toggleItalic().run(),
|
|
32671
|
+
active: editor.isActive("italic")
|
|
32672
|
+
},
|
|
32673
|
+
underline: {
|
|
32674
|
+
disabled: !editor.can().chain().focus().toggleUnderline().run(),
|
|
32675
|
+
active: editor.isActive("underline")
|
|
32676
|
+
},
|
|
32677
|
+
strike: {
|
|
32678
|
+
disabled: !editor.can().chain().focus().toggleStrike().run(),
|
|
32679
|
+
active: editor.isActive("strike")
|
|
32680
|
+
},
|
|
32681
|
+
subscript: {
|
|
32682
|
+
disabled: !editor.can().chain().focus().toggleSubscript().run(),
|
|
32683
|
+
active: editor.isActive("subscript")
|
|
32684
|
+
},
|
|
32685
|
+
superscript: {
|
|
32686
|
+
disabled: !editor.can().chain().focus().toggleSuperscript().run(),
|
|
32687
|
+
active: editor.isActive("superscript")
|
|
32688
|
+
},
|
|
32689
|
+
code: {
|
|
32690
|
+
disabled: !editor.can().chain().focus().toggleCode().run(),
|
|
32691
|
+
active: editor.isActive("code")
|
|
32692
|
+
},
|
|
32693
|
+
link: {
|
|
32694
|
+
disabled: false,
|
|
32695
|
+
// linkは常に有効
|
|
32696
|
+
active: editor.isActive("link")
|
|
32697
|
+
},
|
|
32698
|
+
buttonLikeLink: {
|
|
32699
|
+
disabled: false,
|
|
32700
|
+
active: editor.isActive("buttonLikeLink")
|
|
32701
|
+
},
|
|
32702
|
+
bulletList: {
|
|
32703
|
+
disabled: !editor.can().chain().focus().toggleBulletList().run(),
|
|
32704
|
+
active: editor.isActive("bulletList")
|
|
32705
|
+
},
|
|
32706
|
+
orderedList: {
|
|
32707
|
+
disabled: !editor.can().chain().focus().toggleOrderedList().run(),
|
|
32708
|
+
active: editor.isActive("orderedList")
|
|
32709
|
+
},
|
|
32710
|
+
blockquote: {
|
|
32711
|
+
disabled: !editor.can().chain().focus().toggleBlockquote().run(),
|
|
32712
|
+
active: editor.isActive("blockquote")
|
|
32713
|
+
},
|
|
32714
|
+
note: {
|
|
32715
|
+
disabled: !editor.can().chain().focus().toggleNote().run(),
|
|
32716
|
+
active: editor.isActive("note")
|
|
32717
|
+
},
|
|
32718
|
+
flexBox: {
|
|
32719
|
+
disabled: !editor.can().chain().focus().toggleFlexBox().run(),
|
|
32720
|
+
active: editor.isActive("flexBox")
|
|
32721
|
+
},
|
|
32722
|
+
h1: {
|
|
32723
|
+
disabled: !editor.can().chain().focus().toggleHeading({ level: 1 }).run(),
|
|
32724
|
+
active: editor.isActive("heading", { level: 1 })
|
|
32725
|
+
},
|
|
32726
|
+
h2: {
|
|
32727
|
+
disabled: !editor.can().chain().focus().toggleHeading({ level: 2 }).run(),
|
|
32728
|
+
active: editor.isActive("heading", { level: 2 })
|
|
32729
|
+
},
|
|
32730
|
+
h3: {
|
|
32731
|
+
disabled: !editor.can().chain().focus().toggleHeading({ level: 3 }).run(),
|
|
32732
|
+
active: editor.isActive("heading", { level: 3 })
|
|
32733
|
+
},
|
|
32734
|
+
h4: {
|
|
32735
|
+
disabled: !editor.can().chain().focus().toggleHeading({ level: 4 }).run(),
|
|
32736
|
+
active: editor.isActive("heading", { level: 4 })
|
|
32737
|
+
},
|
|
32738
|
+
h5: {
|
|
32739
|
+
disabled: !editor.can().chain().focus().toggleHeading({ level: 5 }).run(),
|
|
32740
|
+
active: editor.isActive("heading", { level: 5 })
|
|
32741
|
+
},
|
|
32742
|
+
h6: {
|
|
32743
|
+
disabled: !editor.can().chain().focus().toggleHeading({ level: 6 }).run(),
|
|
32744
|
+
active: editor.isActive("heading", { level: 6 })
|
|
32745
|
+
},
|
|
32746
|
+
image: {
|
|
32747
|
+
disabled: !editor.can().chain().focus().setImage({ src: "" }).run(),
|
|
32748
|
+
active: editor.isActive("image")
|
|
32749
|
+
},
|
|
32750
|
+
alignStart: {
|
|
32751
|
+
disabled: !editor.can().chain().focus().toggleAlign("start").run(),
|
|
32752
|
+
active: editor.isActive("paragraph", { "data-bgc-align": "start" })
|
|
32753
|
+
},
|
|
32754
|
+
alignCenter: {
|
|
32755
|
+
disabled: !editor.can().chain().focus().toggleAlign("center").run(),
|
|
32756
|
+
active: editor.isActive("paragraph", { "data-bgc-align": "center" })
|
|
32757
|
+
},
|
|
32758
|
+
alignEnd: {
|
|
32759
|
+
disabled: !editor.can().chain().focus().toggleAlign("end").run(),
|
|
32760
|
+
active: editor.isActive("paragraph", { "data-bgc-align": "end" })
|
|
32761
|
+
}
|
|
32762
|
+
};
|
|
32763
|
+
}
|
|
32658
32764
|
var __defProp$1 = Object.defineProperty;
|
|
32659
32765
|
var __typeError$1 = (msg) => {
|
|
32660
32766
|
throw TypeError(msg);
|
|
@@ -32666,7 +32772,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
32666
32772
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
32667
32773
|
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
32668
32774
|
var __privateMethod = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
32669
|
-
var _editor, _editorRoot, _hasStructureChange, _isExpectingHTML, _isInitializing, _previewStyle, _structureChangeMessage, _textarea, _textareaDescriptor, _BgeWysiwygElement_instances, checkStructureChange_fn, setStructureChange_fn, setToTextarea_fn, transaction_fn, updateStructureChangeMessage_fn;
|
|
32775
|
+
var _editor, _editorRoot, _hasStructureChange, _isExpectingHTML, _isInitializing, _previewStyle, _structureChangeMessage, _textarea, _textareaDescriptor, _textOnlyContainer, _preventEnterKey, _syncTextOnlyToTextarea, _BgeWysiwygElement_instances, activateTextOnlyMode_fn, attachTextOnlyEventListeners_fn, checkStructureChange_fn, cleanTextOnlyHTML_fn, deactivateTextOnlyMode_fn, getTextOnlyValue_fn, identifyEditableElements_fn, setStructureChange_fn, setTextOnlyValue_fn, setToTextarea_fn, transaction_fn, updateStructureChangeMessage_fn;
|
|
32670
32776
|
function defineBgeWysiwygElement(options, global = window) {
|
|
32671
32777
|
if (options?.extensions) {
|
|
32672
32778
|
BgeWysiwygElement.extensions = options.extensions;
|
|
@@ -32674,6 +32780,9 @@ function defineBgeWysiwygElement(options, global = window) {
|
|
|
32674
32780
|
if (options?.wrapperElement) {
|
|
32675
32781
|
BgeWysiwygElement.wrapperElement = options.wrapperElement;
|
|
32676
32782
|
}
|
|
32783
|
+
if (options?.experimental?.textOnlyMode !== void 0) {
|
|
32784
|
+
BgeWysiwygElement.experimentalTextOnlyMode = options.experimental.textOnlyMode;
|
|
32785
|
+
}
|
|
32677
32786
|
const tagName = `bge-wysiwyg`;
|
|
32678
32787
|
if (!global.customElements.get(tagName)) {
|
|
32679
32788
|
global.customElements.define(tagName, BgeWysiwygElement);
|
|
@@ -32692,6 +32801,19 @@ const _BgeWysiwygElement = class _BgeWysiwygElement2 extends HTMLElement {
|
|
|
32692
32801
|
__privateAdd$1(this, _structureChangeMessage, null);
|
|
32693
32802
|
__privateAdd$1(this, _textarea, null);
|
|
32694
32803
|
__privateAdd$1(this, _textareaDescriptor, null);
|
|
32804
|
+
__privateAdd$1(this, _textOnlyContainer, null);
|
|
32805
|
+
__privateAdd$1(this, _preventEnterKey, (event2) => {
|
|
32806
|
+
if (event2.key === "Enter") {
|
|
32807
|
+
event2.preventDefault();
|
|
32808
|
+
}
|
|
32809
|
+
});
|
|
32810
|
+
__privateAdd$1(this, _syncTextOnlyToTextarea, () => {
|
|
32811
|
+
if (this.mode !== "text-only" || !__privateGet$1(this, _textOnlyContainer)) {
|
|
32812
|
+
return;
|
|
32813
|
+
}
|
|
32814
|
+
const cleanHTML = __privateMethod(this, _BgeWysiwygElement_instances, cleanTextOnlyHTML_fn).call(this, "");
|
|
32815
|
+
__privateMethod(this, _BgeWysiwygElement_instances, setToTextarea_fn).call(this, cleanHTML);
|
|
32816
|
+
});
|
|
32695
32817
|
this.attachShadow({ mode: "open" });
|
|
32696
32818
|
if (!this.shadowRoot) {
|
|
32697
32819
|
throw new Error("Not supported shadow DOM");
|
|
@@ -32701,6 +32823,9 @@ const _BgeWysiwygElement = class _BgeWysiwygElement2 extends HTMLElement {
|
|
|
32701
32823
|
if (!__privateGet$1(this, _textarea)) {
|
|
32702
32824
|
throw new ReferenceError("<bge-wysiwyg> is not connected");
|
|
32703
32825
|
}
|
|
32826
|
+
if (this.mode === "text-only") {
|
|
32827
|
+
return __privateMethod(this, _BgeWysiwygElement_instances, getTextOnlyValue_fn).call(this);
|
|
32828
|
+
}
|
|
32704
32829
|
if (this.mode === "wysiwyg") {
|
|
32705
32830
|
if (!__privateGet$1(this, _editor)) {
|
|
32706
32831
|
throw new ReferenceError("<bge-wysiwyg> is not connected");
|
|
@@ -32715,6 +32840,10 @@ const _BgeWysiwygElement = class _BgeWysiwygElement2 extends HTMLElement {
|
|
|
32715
32840
|
if (!__privateGet$1(this, _textarea)) {
|
|
32716
32841
|
throw new ReferenceError("<bge-wysiwyg> is not connected");
|
|
32717
32842
|
}
|
|
32843
|
+
if (this.mode === "text-only") {
|
|
32844
|
+
__privateMethod(this, _BgeWysiwygElement_instances, setTextOnlyValue_fn).call(this, value);
|
|
32845
|
+
return;
|
|
32846
|
+
}
|
|
32718
32847
|
if (this.mode === "html") {
|
|
32719
32848
|
__privateGet$1(this, _textareaDescriptor)?.set?.call(__privateGet$1(this, _textarea), value);
|
|
32720
32849
|
return;
|
|
@@ -32738,16 +32867,25 @@ const _BgeWysiwygElement = class _BgeWysiwygElement2 extends HTMLElement {
|
|
|
32738
32867
|
}
|
|
32739
32868
|
get mode() {
|
|
32740
32869
|
const modeAttr = this.shadowRoot?.querySelector(`[data-bge-mode]`)?.dataset.bgeMode;
|
|
32741
|
-
|
|
32870
|
+
if (modeAttr === "html") return "html";
|
|
32871
|
+
if (modeAttr === "text-only") return "text-only";
|
|
32872
|
+
return "wysiwyg";
|
|
32742
32873
|
}
|
|
32743
32874
|
set mode(mode) {
|
|
32744
32875
|
if (!__privateGet$1(this, _editor) || !__privateGet$1(this, _textarea)) {
|
|
32745
32876
|
return;
|
|
32746
32877
|
}
|
|
32878
|
+
if (this.mode === "text-only") {
|
|
32879
|
+
__privateMethod(this, _BgeWysiwygElement_instances, deactivateTextOnlyMode_fn).call(this);
|
|
32880
|
+
}
|
|
32747
32881
|
if (mode === "wysiwyg" && this.mode === "html" && __privateMethod(this, _BgeWysiwygElement_instances, checkStructureChange_fn).call(this)) {
|
|
32748
32882
|
__privateMethod(this, _BgeWysiwygElement_instances, setStructureChange_fn).call(this, true);
|
|
32749
32883
|
return;
|
|
32750
32884
|
}
|
|
32885
|
+
if (mode === "text-only") {
|
|
32886
|
+
__privateMethod(this, _BgeWysiwygElement_instances, activateTextOnlyMode_fn).call(this);
|
|
32887
|
+
return;
|
|
32888
|
+
}
|
|
32751
32889
|
this.shadowRoot.querySelector(`[data-bge-mode]`)?.setAttribute(
|
|
32752
32890
|
"data-bge-mode",
|
|
32753
32891
|
mode
|
|
@@ -32777,7 +32915,7 @@ const _BgeWysiwygElement = class _BgeWysiwygElement2 extends HTMLElement {
|
|
|
32777
32915
|
const label = this.getAttribute("label") ?? "内容";
|
|
32778
32916
|
const itemName = this.getAttribute("item-name");
|
|
32779
32917
|
const messageId = `bge-structure-change-message-${Math.random().toString(36).slice(2, 11)}`;
|
|
32780
|
-
const structureChangeMessage = "HTMLの構造がWYSIWYG(デザイン)モードに対応していません。HTML
|
|
32918
|
+
const structureChangeMessage = _BgeWysiwygElement2.experimentalTextOnlyMode ? "HTMLの構造がデザインモードに対応していません。HTMLモードまたはテキスト編集モードで編集してください。" : "HTMLの構造がWYSIWYG(デザイン)モードに対応していません。HTMLモードで編集してください。";
|
|
32781
32919
|
this.shadowRoot.innerHTML = `<div data-bge-mode="wysiwyg"><iframe></iframe><textarea aria-label="${label} HTML" aria-describedby="${messageId}"></textarea><div id="${messageId}" role="alert" aria-live="polite" style="display: none;">${structureChangeMessage}</div></div>`;
|
|
32782
32920
|
const preview = this.shadowRoot.querySelector("iframe");
|
|
32783
32921
|
if (!preview || !preview.contentWindow || !preview.contentDocument) {
|
|
@@ -32825,6 +32963,42 @@ const _BgeWysiwygElement = class _BgeWysiwygElement2 extends HTMLElement {
|
|
|
32825
32963
|
display: none;
|
|
32826
32964
|
}
|
|
32827
32965
|
|
|
32966
|
+
[data-text-only-editor] {
|
|
32967
|
+
block-size: 50svh;
|
|
32968
|
+
inline-size: 100%;
|
|
32969
|
+
resize: vertical;
|
|
32970
|
+
overflow-y: auto;
|
|
32971
|
+
background: var(--bge-lightest-color);
|
|
32972
|
+
border: 1px solid var(--bge-border-color);
|
|
32973
|
+
border-radius: var(--border-radius);
|
|
32974
|
+
padding: 1rem;
|
|
32975
|
+
box-sizing: border-box;
|
|
32976
|
+
}
|
|
32977
|
+
|
|
32978
|
+
[data-bge-mode="wysiwyg"] [data-text-only-editor],
|
|
32979
|
+
[data-bge-mode="html"] [data-text-only-editor] {
|
|
32980
|
+
display: none;
|
|
32981
|
+
}
|
|
32982
|
+
|
|
32983
|
+
[data-bge-mode="text-only"] iframe,
|
|
32984
|
+
[data-bge-mode="text-only"] textarea {
|
|
32985
|
+
display: none;
|
|
32986
|
+
}
|
|
32987
|
+
|
|
32988
|
+
[contenteditable="plaintext-only"] {
|
|
32989
|
+
outline: 1px dashed var(--bge-border-color);
|
|
32990
|
+
cursor: text;
|
|
32991
|
+
}
|
|
32992
|
+
|
|
32993
|
+
[contenteditable="plaintext-only"]:hover {
|
|
32994
|
+
outline-color: var(--bge-ui-primary-color);
|
|
32995
|
+
}
|
|
32996
|
+
|
|
32997
|
+
[contenteditable="plaintext-only"]:focus {
|
|
32998
|
+
outline: 2px solid var(--bge-ui-primary-color);
|
|
32999
|
+
outline-offset: 2px;
|
|
33000
|
+
}
|
|
33001
|
+
|
|
32828
33002
|
[role="alert"] {
|
|
32829
33003
|
margin-block-start: 0.5rem;
|
|
32830
33004
|
padding: 0.5rem;
|
|
@@ -32966,13 +33140,13 @@ const _BgeWysiwygElement = class _BgeWysiwygElement2 extends HTMLElement {
|
|
|
32966
33140
|
}
|
|
32967
33141
|
|
|
32968
33142
|
iframe,
|
|
32969
|
-
[contenteditable] {
|
|
33143
|
+
[contenteditable="true"] {
|
|
32970
33144
|
padding: 1rem;
|
|
32971
33145
|
block-size: 100%;
|
|
32972
33146
|
box-sizing: border-box;
|
|
32973
33147
|
}
|
|
32974
33148
|
|
|
32975
|
-
[contenteditable]:focus-visible {
|
|
33149
|
+
[contenteditable="true"]:focus-visible {
|
|
32976
33150
|
outline: none;
|
|
32977
33151
|
}
|
|
32978
33152
|
|
|
@@ -33052,7 +33226,40 @@ _previewStyle = /* @__PURE__ */ new WeakMap();
|
|
|
33052
33226
|
_structureChangeMessage = /* @__PURE__ */ new WeakMap();
|
|
33053
33227
|
_textarea = /* @__PURE__ */ new WeakMap();
|
|
33054
33228
|
_textareaDescriptor = /* @__PURE__ */ new WeakMap();
|
|
33229
|
+
_textOnlyContainer = /* @__PURE__ */ new WeakMap();
|
|
33230
|
+
_preventEnterKey = /* @__PURE__ */ new WeakMap();
|
|
33231
|
+
_syncTextOnlyToTextarea = /* @__PURE__ */ new WeakMap();
|
|
33055
33232
|
_BgeWysiwygElement_instances = /* @__PURE__ */ new WeakSet();
|
|
33233
|
+
activateTextOnlyMode_fn = function() {
|
|
33234
|
+
const currentHTML = this.mode === "wysiwyg" ? __privateGet$1(this, _editor).getHTML().replaceAll("<p></p>", "") : __privateGet$1(this, _textarea).value;
|
|
33235
|
+
if (!__privateGet$1(this, _textOnlyContainer)) {
|
|
33236
|
+
__privateSet$1(this, _textOnlyContainer, document.createElement("div"));
|
|
33237
|
+
__privateGet$1(this, _textOnlyContainer).dataset.textOnlyEditor = "";
|
|
33238
|
+
this.shadowRoot.querySelector("[data-bge-mode]").append(__privateGet$1(this, _textOnlyContainer));
|
|
33239
|
+
}
|
|
33240
|
+
const textOnlyStyle = document.createElement("style");
|
|
33241
|
+
textOnlyStyle.dataset.textOnlyStyle = "";
|
|
33242
|
+
if (__privateGet$1(this, _previewStyle)) {
|
|
33243
|
+
textOnlyStyle.textContent = __privateGet$1(this, _previewStyle).textContent;
|
|
33244
|
+
}
|
|
33245
|
+
__privateGet$1(this, _textOnlyContainer).innerHTML = currentHTML;
|
|
33246
|
+
__privateGet$1(this, _textOnlyContainer).prepend(textOnlyStyle);
|
|
33247
|
+
__privateMethod(this, _BgeWysiwygElement_instances, identifyEditableElements_fn).call(this, __privateGet$1(this, _textOnlyContainer));
|
|
33248
|
+
__privateMethod(this, _BgeWysiwygElement_instances, attachTextOnlyEventListeners_fn).call(this);
|
|
33249
|
+
this.shadowRoot.querySelector(`[data-bge-mode]`).dataset.bgeMode = "text-only";
|
|
33250
|
+
};
|
|
33251
|
+
attachTextOnlyEventListeners_fn = function() {
|
|
33252
|
+
if (!__privateGet$1(this, _textOnlyContainer)) {
|
|
33253
|
+
return;
|
|
33254
|
+
}
|
|
33255
|
+
const editableElements = __privateGet$1(this, _textOnlyContainer).querySelectorAll(
|
|
33256
|
+
'[contenteditable="plaintext-only"]'
|
|
33257
|
+
);
|
|
33258
|
+
for (const el of editableElements) {
|
|
33259
|
+
el.addEventListener("keydown", __privateGet$1(this, _preventEnterKey));
|
|
33260
|
+
el.addEventListener("input", __privateGet$1(this, _syncTextOnlyToTextarea));
|
|
33261
|
+
}
|
|
33262
|
+
};
|
|
33056
33263
|
checkStructureChange_fn = function() {
|
|
33057
33264
|
if (!__privateGet$1(this, _editor) || !__privateGet$1(this, _textarea) || this.mode !== "html") {
|
|
33058
33265
|
return false;
|
|
@@ -33061,6 +33268,62 @@ checkStructureChange_fn = function() {
|
|
|
33061
33268
|
const isStructureSame = normalizeHtmlStructure(__privateGet$1(this, _textarea).value, expectedHTML);
|
|
33062
33269
|
return !isStructureSame;
|
|
33063
33270
|
};
|
|
33271
|
+
cleanTextOnlyHTML_fn = function(html2) {
|
|
33272
|
+
if (!__privateGet$1(this, _textOnlyContainer)) {
|
|
33273
|
+
return html2;
|
|
33274
|
+
}
|
|
33275
|
+
const clone = __privateGet$1(this, _textOnlyContainer).cloneNode(true);
|
|
33276
|
+
const editableElements = clone.querySelectorAll('[contenteditable="plaintext-only"]');
|
|
33277
|
+
for (const el of editableElements) {
|
|
33278
|
+
el.removeAttribute("contenteditable");
|
|
33279
|
+
}
|
|
33280
|
+
const styleElements = clone.querySelectorAll("[data-text-only-style]");
|
|
33281
|
+
for (const el of styleElements) {
|
|
33282
|
+
el.remove();
|
|
33283
|
+
}
|
|
33284
|
+
return clone.innerHTML;
|
|
33285
|
+
};
|
|
33286
|
+
deactivateTextOnlyMode_fn = function() {
|
|
33287
|
+
if (!__privateGet$1(this, _textOnlyContainer)) {
|
|
33288
|
+
return;
|
|
33289
|
+
}
|
|
33290
|
+
const editableElements = __privateGet$1(this, _textOnlyContainer).querySelectorAll(
|
|
33291
|
+
'[contenteditable="plaintext-only"]'
|
|
33292
|
+
);
|
|
33293
|
+
for (const el of editableElements) {
|
|
33294
|
+
el.removeEventListener("keydown", __privateGet$1(this, _preventEnterKey));
|
|
33295
|
+
el.removeEventListener("input", __privateGet$1(this, _syncTextOnlyToTextarea));
|
|
33296
|
+
}
|
|
33297
|
+
__privateGet$1(this, _textOnlyContainer).innerHTML = "";
|
|
33298
|
+
};
|
|
33299
|
+
getTextOnlyValue_fn = function() {
|
|
33300
|
+
if (!__privateGet$1(this, _textOnlyContainer)) {
|
|
33301
|
+
return __privateGet$1(this, _textarea)?.value ?? "";
|
|
33302
|
+
}
|
|
33303
|
+
return __privateMethod(this, _BgeWysiwygElement_instances, cleanTextOnlyHTML_fn).call(this, "");
|
|
33304
|
+
};
|
|
33305
|
+
identifyEditableElements_fn = function(container) {
|
|
33306
|
+
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
33307
|
+
acceptNode: (node) => {
|
|
33308
|
+
const element2 = node;
|
|
33309
|
+
const hasDirectTextChild = [...element2.childNodes].some(
|
|
33310
|
+
(child2) => child2.nodeType === Node.TEXT_NODE && child2.textContent?.trim()
|
|
33311
|
+
);
|
|
33312
|
+
if (hasDirectTextChild) {
|
|
33313
|
+
return NodeFilter.FILTER_ACCEPT;
|
|
33314
|
+
}
|
|
33315
|
+
return NodeFilter.FILTER_SKIP;
|
|
33316
|
+
}
|
|
33317
|
+
});
|
|
33318
|
+
const editableElements = [];
|
|
33319
|
+
let currentNode;
|
|
33320
|
+
while (currentNode = walker.nextNode()) {
|
|
33321
|
+
editableElements.push(currentNode);
|
|
33322
|
+
}
|
|
33323
|
+
for (const el of editableElements) {
|
|
33324
|
+
el.setAttribute("contenteditable", "plaintext-only");
|
|
33325
|
+
}
|
|
33326
|
+
};
|
|
33064
33327
|
setStructureChange_fn = function(hasChange) {
|
|
33065
33328
|
if (__privateGet$1(this, _hasStructureChange) === hasChange) {
|
|
33066
33329
|
return;
|
|
@@ -33075,112 +33338,20 @@ setStructureChange_fn = function(hasChange) {
|
|
|
33075
33338
|
})
|
|
33076
33339
|
);
|
|
33077
33340
|
};
|
|
33341
|
+
setTextOnlyValue_fn = function(value) {
|
|
33342
|
+
__privateMethod(this, _BgeWysiwygElement_instances, deactivateTextOnlyMode_fn).call(this);
|
|
33343
|
+
__privateMethod(this, _BgeWysiwygElement_instances, setToTextarea_fn).call(this, value);
|
|
33344
|
+
__privateMethod(this, _BgeWysiwygElement_instances, activateTextOnlyMode_fn).call(this);
|
|
33345
|
+
};
|
|
33078
33346
|
setToTextarea_fn = function(html2) {
|
|
33079
33347
|
if (!__privateGet$1(this, _textarea) || !__privateGet$1(this, _textareaDescriptor)) {
|
|
33080
33348
|
throw new ReferenceError("<bge-wysiwyg> is not connected");
|
|
33081
33349
|
}
|
|
33082
33350
|
__privateGet$1(this, _textareaDescriptor).set?.call(__privateGet$1(this, _textarea), html2);
|
|
33083
33351
|
};
|
|
33084
|
-
transaction_fn = function(
|
|
33352
|
+
transaction_fn = function(_editor2) {
|
|
33085
33353
|
const data = {
|
|
33086
|
-
state:
|
|
33087
|
-
bold: {
|
|
33088
|
-
disabled: !editor.can().chain().focus().toggleBold().run(),
|
|
33089
|
-
active: editor.isActive("bold")
|
|
33090
|
-
},
|
|
33091
|
-
italic: {
|
|
33092
|
-
disabled: !editor.can().chain().focus().toggleItalic().run(),
|
|
33093
|
-
active: editor.isActive("italic")
|
|
33094
|
-
},
|
|
33095
|
-
underline: {
|
|
33096
|
-
disabled: !editor.can().chain().focus().toggleUnderline().run(),
|
|
33097
|
-
active: editor.isActive("underline")
|
|
33098
|
-
},
|
|
33099
|
-
strike: {
|
|
33100
|
-
disabled: !editor.can().chain().focus().toggleStrike().run(),
|
|
33101
|
-
active: editor.isActive("strike")
|
|
33102
|
-
},
|
|
33103
|
-
subscript: {
|
|
33104
|
-
disabled: !editor.can().chain().focus().toggleSubscript().run(),
|
|
33105
|
-
active: editor.isActive("subscript")
|
|
33106
|
-
},
|
|
33107
|
-
superscript: {
|
|
33108
|
-
disabled: !editor.can().chain().focus().toggleSuperscript().run(),
|
|
33109
|
-
active: editor.isActive("superscript")
|
|
33110
|
-
},
|
|
33111
|
-
code: {
|
|
33112
|
-
disabled: !editor.can().chain().focus().toggleCode().run(),
|
|
33113
|
-
active: editor.isActive("code")
|
|
33114
|
-
},
|
|
33115
|
-
link: {
|
|
33116
|
-
disabled: !editor.can().chain().focus().toggleLink().run(),
|
|
33117
|
-
active: editor.isActive("link")
|
|
33118
|
-
},
|
|
33119
|
-
buttonLikeLink: {
|
|
33120
|
-
disabled: !editor.can().chain().focus().toggleButtonLikeLink().run(),
|
|
33121
|
-
active: editor.isActive("buttonLikeLink")
|
|
33122
|
-
},
|
|
33123
|
-
blockquote: {
|
|
33124
|
-
disabled: !editor.can().chain().focus().toggleBlockquote().run(),
|
|
33125
|
-
active: editor.isActive("blockquote")
|
|
33126
|
-
},
|
|
33127
|
-
bulletList: {
|
|
33128
|
-
disabled: !editor.can().chain().focus().toggleBulletList().run(),
|
|
33129
|
-
active: editor.isActive("bulletList")
|
|
33130
|
-
},
|
|
33131
|
-
orderedList: {
|
|
33132
|
-
disabled: !editor.can().chain().focus().toggleOrderedList().run(),
|
|
33133
|
-
active: editor.isActive("orderedList")
|
|
33134
|
-
},
|
|
33135
|
-
note: {
|
|
33136
|
-
disabled: !editor.can().chain().focus().toggleNote().run(),
|
|
33137
|
-
active: editor.isActive("note")
|
|
33138
|
-
},
|
|
33139
|
-
h1: {
|
|
33140
|
-
disabled: !editor.can().chain().focus().toggleHeading({ level: 1 }).run(),
|
|
33141
|
-
active: editor.isActive("heading", { level: 1 })
|
|
33142
|
-
},
|
|
33143
|
-
h2: {
|
|
33144
|
-
disabled: !editor.can().chain().focus().toggleHeading({ level: 2 }).run(),
|
|
33145
|
-
active: editor.isActive("heading", { level: 2 })
|
|
33146
|
-
},
|
|
33147
|
-
h3: {
|
|
33148
|
-
disabled: !editor.can().chain().focus().toggleHeading({ level: 3 }).run(),
|
|
33149
|
-
active: editor.isActive("heading", { level: 3 })
|
|
33150
|
-
},
|
|
33151
|
-
h4: {
|
|
33152
|
-
disabled: !editor.can().chain().focus().toggleHeading({ level: 4 }).run(),
|
|
33153
|
-
active: editor.isActive("heading", { level: 4 })
|
|
33154
|
-
},
|
|
33155
|
-
h5: {
|
|
33156
|
-
disabled: !editor.can().chain().focus().toggleHeading({ level: 5 }).run(),
|
|
33157
|
-
active: editor.isActive("heading", { level: 5 })
|
|
33158
|
-
},
|
|
33159
|
-
h6: {
|
|
33160
|
-
disabled: !editor.can().chain().focus().toggleHeading({ level: 6 }).run(),
|
|
33161
|
-
active: editor.isActive("heading", { level: 6 })
|
|
33162
|
-
},
|
|
33163
|
-
flexBox: {
|
|
33164
|
-
disabled: !editor.can().chain().focus().toggleFlexBox().run(),
|
|
33165
|
-
active: editor.isActive("flexBox")
|
|
33166
|
-
},
|
|
33167
|
-
image: {
|
|
33168
|
-
disabled: !editor.can().chain().focus().setImage({ src: "" }).run(),
|
|
33169
|
-
active: editor.isActive("image")
|
|
33170
|
-
},
|
|
33171
|
-
alignStart: {
|
|
33172
|
-
disabled: !editor.can().chain().focus().toggleAlign("start").run(),
|
|
33173
|
-
active: editor.isActive("paragraph", { "data-bgc-align": "start" })
|
|
33174
|
-
},
|
|
33175
|
-
alignCenter: {
|
|
33176
|
-
disabled: !editor.can().chain().focus().toggleAlign("center").run(),
|
|
33177
|
-
active: editor.isActive("paragraph", { "data-bgc-align": "center" })
|
|
33178
|
-
},
|
|
33179
|
-
alignEnd: {
|
|
33180
|
-
disabled: !editor.can().chain().focus().toggleAlign("end").run(),
|
|
33181
|
-
active: editor.isActive("paragraph", { "data-bgc-align": "end" })
|
|
33182
|
-
}
|
|
33183
|
-
}
|
|
33354
|
+
state: getCurrentEditorState(this)
|
|
33184
33355
|
};
|
|
33185
33356
|
return data;
|
|
33186
33357
|
};
|
|
@@ -33196,6 +33367,7 @@ updateStructureChangeMessage_fn = function() {
|
|
|
33196
33367
|
};
|
|
33197
33368
|
__publicField$1(_BgeWysiwygElement, "extensions", null);
|
|
33198
33369
|
__publicField$1(_BgeWysiwygElement, "wrapperElement", null);
|
|
33370
|
+
__publicField$1(_BgeWysiwygElement, "experimentalTextOnlyMode", false);
|
|
33199
33371
|
let BgeWysiwygElement = _BgeWysiwygElement;
|
|
33200
33372
|
var __defProp = Object.defineProperty;
|
|
33201
33373
|
var __typeError = (msg) => {
|
|
@@ -33208,11 +33380,40 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
33208
33380
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
33209
33381
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
33210
33382
|
var _wysiwygElement;
|
|
33383
|
+
const BUTTON_TO_STATE_KEY_MAP = {
|
|
33384
|
+
bold: "bold",
|
|
33385
|
+
italic: "italic",
|
|
33386
|
+
underline: "underline",
|
|
33387
|
+
strikethrough: "strike",
|
|
33388
|
+
code: "code",
|
|
33389
|
+
link: "link",
|
|
33390
|
+
"button-like-link": "buttonLikeLink",
|
|
33391
|
+
blockquote: "blockquote",
|
|
33392
|
+
"bullet-list": "bulletList",
|
|
33393
|
+
"ordered-list": "orderedList",
|
|
33394
|
+
note: "note",
|
|
33395
|
+
h1: "h1",
|
|
33396
|
+
h2: "h2",
|
|
33397
|
+
h3: "h3",
|
|
33398
|
+
h4: "h4",
|
|
33399
|
+
h5: "h5",
|
|
33400
|
+
h6: "h6",
|
|
33401
|
+
"flex-box": "flexBox",
|
|
33402
|
+
subscript: "subscript",
|
|
33403
|
+
superscript: "superscript",
|
|
33404
|
+
"align-start": "alignStart",
|
|
33405
|
+
"align-center": "alignCenter",
|
|
33406
|
+
"align-end": "alignEnd",
|
|
33407
|
+
image: "image"
|
|
33408
|
+
};
|
|
33211
33409
|
function defineBgeWysiwygEditorElement(options, global = window) {
|
|
33212
33410
|
defineBgeWysiwygElement(options, global);
|
|
33213
33411
|
if (options?.wrapperElement) {
|
|
33214
33412
|
BgeWysiwygEditorElement.wrapperElement = options.wrapperElement;
|
|
33215
33413
|
}
|
|
33414
|
+
if (options?.experimental?.textOnlyMode !== void 0) {
|
|
33415
|
+
BgeWysiwygEditorElement.experimentalTextOnlyMode = options.experimental.textOnlyMode;
|
|
33416
|
+
}
|
|
33216
33417
|
const tagName = `bge-wysiwyg-editor`;
|
|
33217
33418
|
if (!global.customElements.get(tagName)) {
|
|
33218
33419
|
global.customElements.define(tagName, BgeWysiwygEditorElement);
|
|
@@ -33260,7 +33461,11 @@ const _BgeWysiwygEditorElement = class _BgeWysiwygEditorElement2 extends HTMLEle
|
|
|
33260
33461
|
${commands.includes("align-end") ? `<button type="button" data-bge-toolbar-button="align-end">${IconAlignRight}</button>` : ""}
|
|
33261
33462
|
</div>
|
|
33262
33463
|
<div data-bge-toolbar-group>
|
|
33263
|
-
|
|
33464
|
+
${_BgeWysiwygEditorElement2.experimentalTextOnlyMode ? `<select data-bge-mode-selector>
|
|
33465
|
+
<option value="wysiwyg">デザインモード</option>
|
|
33466
|
+
<option value="text-only">テキスト編集モード</option>
|
|
33467
|
+
<option value="html">HTMLモード</option>
|
|
33468
|
+
</select>` : `<button type="button" data-bge-toolbar-button="html-mode">HTML Mode</button>`}
|
|
33264
33469
|
</div>
|
|
33265
33470
|
</div>
|
|
33266
33471
|
<bge-wysiwyg ${itemName ? `item-name="${itemName}"` : ""}>
|
|
@@ -33301,6 +33506,16 @@ const _BgeWysiwygEditorElement = class _BgeWysiwygEditorElement2 extends HTMLEle
|
|
|
33301
33506
|
}
|
|
33302
33507
|
return __privateGet(this, _wysiwygElement).value;
|
|
33303
33508
|
}
|
|
33509
|
+
/**
|
|
33510
|
+
* 現在のエディタモードを取得
|
|
33511
|
+
* @returns 'wysiwyg' | 'html' | 'text-only'
|
|
33512
|
+
*/
|
|
33513
|
+
get mode() {
|
|
33514
|
+
if (!__privateGet(this, _wysiwygElement)) {
|
|
33515
|
+
throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
|
|
33516
|
+
}
|
|
33517
|
+
return __privateGet(this, _wysiwygElement).mode;
|
|
33518
|
+
}
|
|
33304
33519
|
connectedCallback() {
|
|
33305
33520
|
__privateSet(this, _wysiwygElement, this.querySelector("bge-wysiwyg"));
|
|
33306
33521
|
if (!__privateGet(this, _wysiwygElement)) {
|
|
@@ -33317,35 +33532,86 @@ const _BgeWysiwygEditorElement = class _BgeWysiwygEditorElement2 extends HTMLEle
|
|
|
33317
33532
|
}
|
|
33318
33533
|
__privateGet(this, _wysiwygElement).addEventListener("transaction", (event2) => {
|
|
33319
33534
|
for (const button of buttons) {
|
|
33320
|
-
updateButtonState(button, event2.detail.state);
|
|
33535
|
+
updateButtonState(button, event2.detail.state, this);
|
|
33321
33536
|
}
|
|
33322
33537
|
});
|
|
33323
|
-
|
|
33324
|
-
|
|
33325
|
-
|
|
33326
|
-
|
|
33327
|
-
|
|
33328
|
-
|
|
33329
|
-
htmlModeButton.disabled = isHtmlMode && hasStructureChange;
|
|
33330
|
-
});
|
|
33331
|
-
const initialHasStructureChange = __privateGet(this, _wysiwygElement).hasStructureChange;
|
|
33332
|
-
const initialIsHtmlMode = __privateGet(this, _wysiwygElement).mode === "html";
|
|
33333
|
-
htmlModeButton.disabled = initialIsHtmlMode && initialHasStructureChange;
|
|
33334
|
-
htmlModeButton.addEventListener("click", () => {
|
|
33335
|
-
if (!__privateGet(this, _wysiwygElement)) {
|
|
33336
|
-
throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
|
|
33337
|
-
}
|
|
33338
|
-
const currentMode = __privateGet(this, _wysiwygElement).mode;
|
|
33339
|
-
const newMode = currentMode === "html" ? "wysiwyg" : "html";
|
|
33340
|
-
htmlModeButton.ariaPressed = newMode === "html" ? "true" : "false";
|
|
33341
|
-
__privateGet(this, _wysiwygElement).mode = newMode;
|
|
33342
|
-
if (__privateGet(this, _wysiwygElement).mode === newMode) {
|
|
33343
|
-
const hasStructureChange = __privateGet(this, _wysiwygElement).hasStructureChange;
|
|
33344
|
-
htmlModeButton.disabled = newMode === "html" && hasStructureChange;
|
|
33345
|
-
} else {
|
|
33346
|
-
htmlModeButton.ariaPressed = currentMode === "html" ? "true" : "false";
|
|
33538
|
+
if (_BgeWysiwygEditorElement2.experimentalTextOnlyMode) {
|
|
33539
|
+
const modeSelector = this.querySelector(
|
|
33540
|
+
"[data-bge-mode-selector]"
|
|
33541
|
+
);
|
|
33542
|
+
if (!modeSelector) {
|
|
33543
|
+
throw new Error("Mode selector not found");
|
|
33347
33544
|
}
|
|
33348
|
-
|
|
33545
|
+
modeSelector.value = __privateGet(this, _wysiwygElement).mode;
|
|
33546
|
+
const initialHasStructureChange = __privateGet(this, _wysiwygElement).hasStructureChange;
|
|
33547
|
+
const wysiwygOption = modeSelector.querySelector(
|
|
33548
|
+
'option[value="wysiwyg"]'
|
|
33549
|
+
);
|
|
33550
|
+
if (wysiwygOption) {
|
|
33551
|
+
wysiwygOption.disabled = initialHasStructureChange;
|
|
33552
|
+
}
|
|
33553
|
+
const handleStructureChange = (event2) => {
|
|
33554
|
+
const hasStructureChange = event2.detail.hasStructureChange;
|
|
33555
|
+
if (wysiwygOption) {
|
|
33556
|
+
wysiwygOption.disabled = hasStructureChange;
|
|
33557
|
+
}
|
|
33558
|
+
};
|
|
33559
|
+
__privateGet(this, _wysiwygElement).addEventListener(
|
|
33560
|
+
"bge:structure-change",
|
|
33561
|
+
handleStructureChange
|
|
33562
|
+
);
|
|
33563
|
+
modeSelector.addEventListener("change", () => {
|
|
33564
|
+
if (!__privateGet(this, _wysiwygElement)) {
|
|
33565
|
+
throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
|
|
33566
|
+
}
|
|
33567
|
+
const newMode = modeSelector.value;
|
|
33568
|
+
const currentMode = __privateGet(this, _wysiwygElement).mode;
|
|
33569
|
+
__privateGet(this, _wysiwygElement).mode = newMode;
|
|
33570
|
+
if (__privateGet(this, _wysiwygElement).mode === newMode) {
|
|
33571
|
+
const currentState = getCurrentEditorState(__privateGet(this, _wysiwygElement));
|
|
33572
|
+
for (const button of buttons) {
|
|
33573
|
+
updateButtonState(button, currentState, this);
|
|
33574
|
+
}
|
|
33575
|
+
} else {
|
|
33576
|
+
modeSelector.value = currentMode;
|
|
33577
|
+
}
|
|
33578
|
+
});
|
|
33579
|
+
} else {
|
|
33580
|
+
const htmlModeButton = this.querySelector(
|
|
33581
|
+
'[data-bge-toolbar-button="html-mode"]'
|
|
33582
|
+
);
|
|
33583
|
+
if (!htmlModeButton) {
|
|
33584
|
+
throw new Error("HTML mode button not found");
|
|
33585
|
+
}
|
|
33586
|
+
const initialHasStructureChange = __privateGet(this, _wysiwygElement).hasStructureChange;
|
|
33587
|
+
const initialIsHtmlMode = __privateGet(this, _wysiwygElement).mode === "html";
|
|
33588
|
+
htmlModeButton.disabled = initialIsHtmlMode && initialHasStructureChange;
|
|
33589
|
+
htmlModeButton.ariaPressed = initialIsHtmlMode ? "true" : "false";
|
|
33590
|
+
htmlModeButton.addEventListener("click", () => {
|
|
33591
|
+
if (!__privateGet(this, _wysiwygElement)) {
|
|
33592
|
+
throw new ReferenceError("<bge-wysiwyg-editor> is not connected");
|
|
33593
|
+
}
|
|
33594
|
+
const currentMode = __privateGet(this, _wysiwygElement).mode;
|
|
33595
|
+
const newMode = currentMode === "html" ? "wysiwyg" : "html";
|
|
33596
|
+
htmlModeButton.ariaPressed = newMode === "html" ? "true" : "false";
|
|
33597
|
+
__privateGet(this, _wysiwygElement).mode = newMode;
|
|
33598
|
+
if (__privateGet(this, _wysiwygElement).mode === newMode) {
|
|
33599
|
+
const currentState = getCurrentEditorState(__privateGet(this, _wysiwygElement));
|
|
33600
|
+
for (const button of buttons) {
|
|
33601
|
+
updateButtonState(button, currentState, this);
|
|
33602
|
+
}
|
|
33603
|
+
const hasStructureChange = __privateGet(this, _wysiwygElement).hasStructureChange;
|
|
33604
|
+
htmlModeButton.disabled = newMode === "html" && hasStructureChange;
|
|
33605
|
+
} else {
|
|
33606
|
+
htmlModeButton.ariaPressed = currentMode === "html" ? "true" : "false";
|
|
33607
|
+
}
|
|
33608
|
+
});
|
|
33609
|
+
__privateGet(this, _wysiwygElement).addEventListener("bge:structure-change", (event2) => {
|
|
33610
|
+
const hasStructureChange = event2.detail.hasStructureChange;
|
|
33611
|
+
const isHtmlMode = __privateGet(this, _wysiwygElement).mode === "html";
|
|
33612
|
+
htmlModeButton.disabled = isHtmlMode && hasStructureChange;
|
|
33613
|
+
});
|
|
33614
|
+
}
|
|
33349
33615
|
}
|
|
33350
33616
|
setStyle(css) {
|
|
33351
33617
|
if (!__privateGet(this, _wysiwygElement)) {
|
|
@@ -33363,6 +33629,7 @@ const _BgeWysiwygEditorElement = class _BgeWysiwygEditorElement2 extends HTMLEle
|
|
|
33363
33629
|
_wysiwygElement = /* @__PURE__ */ new WeakMap();
|
|
33364
33630
|
__publicField(_BgeWysiwygEditorElement, "extensions", null);
|
|
33365
33631
|
__publicField(_BgeWysiwygEditorElement, "wrapperElement", null);
|
|
33632
|
+
__publicField(_BgeWysiwygEditorElement, "experimentalTextOnlyMode", false);
|
|
33366
33633
|
__publicField(_BgeWysiwygEditorElement, "defaultCommands", [
|
|
33367
33634
|
"bold",
|
|
33368
33635
|
"italic",
|
|
@@ -33499,120 +33766,23 @@ function bindToggle(button, wysiwygElement) {
|
|
|
33499
33766
|
}
|
|
33500
33767
|
}
|
|
33501
33768
|
}
|
|
33502
|
-
function updateButtonState(button, state2) {
|
|
33769
|
+
function updateButtonState(button, state2, editorElement) {
|
|
33503
33770
|
const buttonType = button.dataset.bgeToolbarButton;
|
|
33504
|
-
|
|
33505
|
-
|
|
33506
|
-
|
|
33507
|
-
|
|
33508
|
-
|
|
33509
|
-
|
|
33510
|
-
|
|
33511
|
-
button.disabled = state2.italic.disabled;
|
|
33512
|
-
button.ariaPressed = state2.italic.active ? "true" : "false";
|
|
33513
|
-
break;
|
|
33514
|
-
}
|
|
33515
|
-
case "underline": {
|
|
33516
|
-
button.disabled = state2.underline.disabled;
|
|
33517
|
-
button.ariaPressed = state2.underline.active ? "true" : "false";
|
|
33518
|
-
break;
|
|
33519
|
-
}
|
|
33520
|
-
case "strikethrough": {
|
|
33521
|
-
button.disabled = state2.strike.disabled;
|
|
33522
|
-
button.ariaPressed = state2.strike.active ? "true" : "false";
|
|
33523
|
-
break;
|
|
33524
|
-
}
|
|
33525
|
-
case "code": {
|
|
33526
|
-
button.disabled = state2.code.disabled;
|
|
33527
|
-
button.ariaPressed = state2.code.active ? "true" : "false";
|
|
33528
|
-
break;
|
|
33529
|
-
}
|
|
33530
|
-
case "link": {
|
|
33531
|
-
button.disabled = state2.link.disabled;
|
|
33532
|
-
button.ariaPressed = state2.link.active ? "true" : "false";
|
|
33533
|
-
break;
|
|
33534
|
-
}
|
|
33535
|
-
case "button-like-link": {
|
|
33536
|
-
button.disabled = state2.buttonLikeLink.disabled;
|
|
33537
|
-
button.ariaPressed = state2.buttonLikeLink.active ? "true" : "false";
|
|
33538
|
-
break;
|
|
33539
|
-
}
|
|
33540
|
-
case "blockquote": {
|
|
33541
|
-
button.disabled = state2.blockquote.disabled;
|
|
33542
|
-
button.ariaPressed = state2.blockquote.active ? "true" : "false";
|
|
33543
|
-
break;
|
|
33544
|
-
}
|
|
33545
|
-
case "bullet-list": {
|
|
33546
|
-
button.disabled = state2.bulletList.disabled;
|
|
33547
|
-
button.ariaPressed = state2.bulletList.active ? "true" : "false";
|
|
33548
|
-
break;
|
|
33549
|
-
}
|
|
33550
|
-
case "ordered-list": {
|
|
33551
|
-
button.disabled = state2.orderedList.disabled;
|
|
33552
|
-
button.ariaPressed = state2.orderedList.active ? "true" : "false";
|
|
33553
|
-
break;
|
|
33554
|
-
}
|
|
33555
|
-
case "note": {
|
|
33556
|
-
button.disabled = state2.note.disabled;
|
|
33557
|
-
button.ariaPressed = state2.note.active ? "true" : "false";
|
|
33558
|
-
break;
|
|
33559
|
-
}
|
|
33560
|
-
case "h2": {
|
|
33561
|
-
button.disabled = state2.h2.disabled;
|
|
33562
|
-
button.ariaPressed = state2.h2.active ? "true" : "false";
|
|
33563
|
-
break;
|
|
33564
|
-
}
|
|
33565
|
-
case "h3": {
|
|
33566
|
-
button.disabled = state2.h3.disabled;
|
|
33567
|
-
button.ariaPressed = state2.h3.active ? "true" : "false";
|
|
33568
|
-
break;
|
|
33569
|
-
}
|
|
33570
|
-
case "h4": {
|
|
33571
|
-
button.disabled = state2.h4.disabled;
|
|
33572
|
-
button.ariaPressed = state2.h4.active ? "true" : "false";
|
|
33573
|
-
break;
|
|
33574
|
-
}
|
|
33575
|
-
case "h5": {
|
|
33576
|
-
button.disabled = state2.h5.disabled;
|
|
33577
|
-
button.ariaPressed = state2.h5.active ? "true" : "false";
|
|
33578
|
-
break;
|
|
33579
|
-
}
|
|
33580
|
-
case "h6": {
|
|
33581
|
-
button.disabled = state2.h6.disabled;
|
|
33582
|
-
button.ariaPressed = state2.h6.active ? "true" : "false";
|
|
33583
|
-
break;
|
|
33584
|
-
}
|
|
33585
|
-
case "flex-box": {
|
|
33586
|
-
button.disabled = state2.flexBox.disabled;
|
|
33587
|
-
button.ariaPressed = state2.flexBox.active ? "true" : "false";
|
|
33588
|
-
break;
|
|
33589
|
-
}
|
|
33590
|
-
case "subscript": {
|
|
33591
|
-
button.disabled = state2.subscript.disabled;
|
|
33592
|
-
button.ariaPressed = state2.subscript.active ? "true" : "false";
|
|
33593
|
-
break;
|
|
33594
|
-
}
|
|
33595
|
-
case "superscript": {
|
|
33596
|
-
button.disabled = state2.superscript.disabled;
|
|
33597
|
-
button.ariaPressed = state2.superscript.active ? "true" : "false";
|
|
33598
|
-
break;
|
|
33599
|
-
}
|
|
33600
|
-
case "align-start": {
|
|
33601
|
-
button.disabled = state2.alignStart.disabled;
|
|
33602
|
-
button.ariaPressed = state2.alignStart.active ? "true" : "false";
|
|
33603
|
-
break;
|
|
33604
|
-
}
|
|
33605
|
-
case "align-center": {
|
|
33606
|
-
button.disabled = state2.alignCenter.disabled;
|
|
33607
|
-
button.ariaPressed = state2.alignCenter.active ? "true" : "false";
|
|
33608
|
-
break;
|
|
33609
|
-
}
|
|
33610
|
-
case "align-end": {
|
|
33611
|
-
button.disabled = state2.alignEnd.disabled;
|
|
33612
|
-
button.ariaPressed = state2.alignEnd.active ? "true" : "false";
|
|
33613
|
-
break;
|
|
33771
|
+
if (buttonType === "html-mode" || buttonType === "text-only-mode") {
|
|
33772
|
+
return;
|
|
33773
|
+
}
|
|
33774
|
+
const stateKey = BUTTON_TO_STATE_KEY_MAP[buttonType];
|
|
33775
|
+
if (!stateKey) {
|
|
33776
|
+
if (process.env.NODE_ENV !== "production") {
|
|
33777
|
+
console.warn(`Unknown button type: ${buttonType}`);
|
|
33614
33778
|
}
|
|
33779
|
+
return;
|
|
33615
33780
|
}
|
|
33781
|
+
const currentMode = editorElement.mode;
|
|
33782
|
+
const isNonWysiwygMode = currentMode === "html" || currentMode === "text-only";
|
|
33783
|
+
const buttonState = state2[stateKey];
|
|
33784
|
+
button.disabled = isNonWysiwygMode || buttonState.disabled;
|
|
33785
|
+
button.ariaPressed = buttonState.active ? "true" : "false";
|
|
33616
33786
|
}
|
|
33617
33787
|
const PUBLIC_VERSION = "5";
|
|
33618
33788
|
if (typeof window !== "undefined") {
|
|
@@ -36008,6 +36178,16 @@ function update_reaction(reaction) {
|
|
|
36008
36178
|
}
|
|
36009
36179
|
if (previous_reaction !== null && previous_reaction !== reaction) {
|
|
36010
36180
|
read_version++;
|
|
36181
|
+
if (previous_reaction.deps !== null) {
|
|
36182
|
+
for (let i2 = 0; i2 < previous_skipped_deps; i2 += 1) {
|
|
36183
|
+
previous_reaction.deps[i2].rv = read_version;
|
|
36184
|
+
}
|
|
36185
|
+
}
|
|
36186
|
+
if (previous_deps !== null) {
|
|
36187
|
+
for (const dep of previous_deps) {
|
|
36188
|
+
dep.rv = read_version;
|
|
36189
|
+
}
|
|
36190
|
+
}
|
|
36011
36191
|
if (untracked_writes !== null) {
|
|
36012
36192
|
if (previous_untracked_writes === null) {
|
|
36013
36193
|
previous_untracked_writes = untracked_writes;
|
|
@@ -36119,7 +36299,7 @@ function get2(signal) {
|
|
|
36119
36299
|
skipped_deps++;
|
|
36120
36300
|
} else if (new_deps === null) {
|
|
36121
36301
|
new_deps = [signal];
|
|
36122
|
-
} else
|
|
36302
|
+
} else {
|
|
36123
36303
|
new_deps.push(signal);
|
|
36124
36304
|
}
|
|
36125
36305
|
}
|
|
@@ -40339,7 +40519,10 @@ async function createBurgerEditorClient(options) {
|
|
|
40339
40519
|
defineBgeWysiwygEditorElement({
|
|
40340
40520
|
wrapperElement: {
|
|
40341
40521
|
className: context.className ?? ""
|
|
40342
|
-
}
|
|
40522
|
+
},
|
|
40523
|
+
experimental: context.experimental?.itemOptions?.wysiwyg?.enableTextOnlyMode ? {
|
|
40524
|
+
textOnlyMode: context.experimental.itemOptions.wysiwyg.enableTextOnlyMode
|
|
40525
|
+
} : void 0
|
|
40343
40526
|
});
|
|
40344
40527
|
}
|
|
40345
40528
|
});
|