@ones-editor/editor 2.2.16-beta.1 → 2.2.16-beta.11
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/@ones-editor/core/src/core/command-providers/block-attributes.d.ts +1 -0
- package/@ones-editor/drawio-embed/src/dom/toast.d.ts +2 -0
- package/@ones-editor/drawio-embed/src/helper/paste-handler.d.ts +8 -0
- package/@ones-editor/drawio-embed/src/index.d.ts +2 -1
- package/@ones-editor/drawio-embed/src/lang/en-us.d.ts +1 -0
- package/@ones-editor/drawio-embed/src/lang/ja-jp.d.ts +1 -0
- package/@ones-editor/drawio-embed/src/lang/zh-cn.d.ts +1 -0
- package/@ones-editor/mobile-helper/src/selection-gripper/select-handle.d.ts +2 -2
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui-base/src/toast/index.d.ts +2 -1
- package/dist/index.js +1489 -1393
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -84,10 +84,13 @@ div.editor-root div.editor-content .editor-input {
|
|
|
84
84
|
position: absolute;
|
|
85
85
|
opacity: 0;
|
|
86
86
|
pointer-events: none;
|
|
87
|
+
caret-color: transparent;
|
|
87
88
|
/* width cannot be too small, otherwise the input will not receive the compositionend message */
|
|
88
89
|
width: 16px;
|
|
89
90
|
height: 20px;
|
|
90
91
|
font-size: 16px;
|
|
92
|
+
white-space: nowrap;
|
|
93
|
+
overflow: hidden;
|
|
91
94
|
}
|
|
92
95
|
div.editor-root div.editor-content div[data-type=editor-container] {
|
|
93
96
|
position: relative;
|
|
@@ -762,7 +765,7 @@ div.comment-editor-root div.root.select-all > .container-blocks > div[data-type=
|
|
|
762
765
|
::placeholder {
|
|
763
766
|
color: #bbb;
|
|
764
767
|
}/* The snackbar - position it at the bottom and in the middle of the screen */
|
|
765
|
-
.toast {
|
|
768
|
+
.ones-editor-toast {
|
|
766
769
|
font-family: Avenir, Helvetica, Arial, sans-serif;
|
|
767
770
|
visibility: hidden; /* Hidden by default. Visible on click */
|
|
768
771
|
min-width: 250px; /* Set a default minimum width */
|
|
@@ -773,20 +776,35 @@ div.comment-editor-root div.root.select-all > .container-blocks > div[data-type=
|
|
|
773
776
|
border-radius: 2px; /* Rounded borders */
|
|
774
777
|
padding: 8px; /* Padding */
|
|
775
778
|
position: fixed; /* Sit on top of the screen */
|
|
776
|
-
z-index:
|
|
779
|
+
z-index: 12000; /* Add a z-index if needed */
|
|
777
780
|
left: 50%; /* Center the snackbar */
|
|
778
781
|
bottom: 30px; /* 30px from the bottom */
|
|
782
|
+
display: flex;
|
|
783
|
+
align-items: center;
|
|
784
|
+
justify-content: space-between;
|
|
785
|
+
font-size: 14px;
|
|
779
786
|
}
|
|
780
|
-
.toast.show {
|
|
787
|
+
.ones-editor-toast.show {
|
|
781
788
|
visibility: visible; /* Show the snackbar */
|
|
782
789
|
animation: toast_fade_in 0.5s, toast_fade_out 0.5s 2.5s;
|
|
783
790
|
}
|
|
784
|
-
.toast.positioned.show {
|
|
791
|
+
.ones-editor-toast.positioned.show {
|
|
785
792
|
animation: toast_fade_in_positioned 0.5s, toast_fade_out_positioned 0.5s 2.5s;
|
|
786
793
|
}
|
|
787
|
-
.toast.positioned {
|
|
794
|
+
.ones-editor-toast.positioned {
|
|
788
795
|
bottom: unset;
|
|
789
796
|
}
|
|
797
|
+
.ones-editor-toast > .close {
|
|
798
|
+
width: 24px;
|
|
799
|
+
height: 24px;
|
|
800
|
+
justify-content: center;
|
|
801
|
+
display: inline-flex;
|
|
802
|
+
align-items: center;
|
|
803
|
+
cursor: pointer;
|
|
804
|
+
}
|
|
805
|
+
.ones-editor-toast > .close:hover {
|
|
806
|
+
background-color: rgba(255, 255, 255, 0.1019607843);
|
|
807
|
+
}
|
|
790
808
|
@keyframes toast_fade_in {
|
|
791
809
|
from {
|
|
792
810
|
bottom: 0;
|
|
@@ -7036,7 +7054,7 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
|
|
|
7036
7054
|
}
|
|
7037
7055
|
[data-command-bar-id=editor-toolbar] .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .line,
|
|
7038
7056
|
.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .line {
|
|
7039
|
-
width:
|
|
7057
|
+
width: 2px;
|
|
7040
7058
|
height: 16px;
|
|
7041
7059
|
background-color: var(--primary-color);
|
|
7042
7060
|
flex-grow: 1;
|
|
@@ -7044,8 +7062,8 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
|
|
|
7044
7062
|
}
|
|
7045
7063
|
[data-command-bar-id=editor-toolbar] .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .circle,
|
|
7046
7064
|
.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .circle {
|
|
7047
|
-
width:
|
|
7048
|
-
height:
|
|
7065
|
+
width: 8px;
|
|
7066
|
+
height: 8px;
|
|
7049
7067
|
border-radius: 50%;
|
|
7050
7068
|
flex-grow: 0;
|
|
7051
7069
|
flex-shrink: 0;
|
|
@@ -7067,6 +7085,132 @@ div.editor-root div.editor-content div[data-block-type=embed] > .embed-mask::aft
|
|
|
7067
7085
|
bottom: 0;
|
|
7068
7086
|
z-index: 999;
|
|
7069
7087
|
opacity: 0;
|
|
7088
|
+
}.ones-editor-toast[data-theme=warn] {
|
|
7089
|
+
background-color: #f59300;
|
|
7090
|
+
}
|
|
7091
|
+
.ones-editor-toast[data-theme=warn] .toast-message {
|
|
7092
|
+
display: inline-flex;
|
|
7093
|
+
align-items: center;
|
|
7094
|
+
}
|
|
7095
|
+
.ones-editor-toast[data-theme=warn] .toast-message svg {
|
|
7096
|
+
margin-right: 8px;
|
|
7097
|
+
width: 24px;
|
|
7098
|
+
height: 24px;
|
|
7099
|
+
fill: white;
|
|
7100
|
+
}
|
|
7101
|
+
.ones-editor-toast[data-theme=warn] a {
|
|
7102
|
+
margin-left: 5px;
|
|
7103
|
+
text-decoration: underline;
|
|
7104
|
+
cursor: pointer;
|
|
7105
|
+
}:root {
|
|
7106
|
+
--editor-quoted-color: #7084a4;
|
|
7107
|
+
--editor-drawio-empty-svg: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zOC43MjAzIDI4LjcwOTdIMjUuOTIzM0MyNS4yMTY1IDI4LjcwOTcgMjQuNjQzNSAyOC4xNDgxIDI0LjY0MzUgMjcuNDU1MlYyNS43MzMzSDIwLjUyODNDMjAuNDk4NiAyNS43Njk2IDIwLjQ2NjkgMjUuODA0MiAyMC40MzMzIDI1LjgzN0wxNS45MTkyIDMwLjI2MjFWMzQuNzU1NkgyNC42NDM1VjMzLjcyNzZDMjQuNjQzNSAzMy4wMzQ4IDI1LjIxNjUgMzIuNDczMiAyNS45MjMzIDMyLjQ3MzJIMzguNzIwM0MzOS40MjcgMzIuNDczMiA0MCAzMy4wMzQ4IDQwIDMzLjcyNzZWMzguNzQ1NUM0MCAzOS40MzgzIDM5LjQyNyA0MCAzOC43MjAzIDQwSDI1LjkyMzNDMjUuMjE2NSA0MCAyNC42NDM1IDM5LjQzODMgMjQuNjQzNSAzOC43NDU1VjM3LjMzMzNIMTQuNjI2M0MxMy45MTIyIDM3LjMzMzMgMTMuMzMzMyAzNi43NTYyIDEzLjMzMzMgMzYuMDQ0NFYzMC42OTQxTDguMzc4NTIgMjUuODM3QzguMTM2MjYgMjUuNjAxNCA4IDI1LjI4MDggOCAyNC45NDYzQzggMjQuNjExOCA4LjEzNjI2IDI0LjI5MTEgOC4zNzg1MiAyNC4wNTU2TDEzLjMzMzMgMTkuMTk4NVYxNS43NzJDMTEuNzc5OCAxNS4yMjI5IDEwLjY2NjcgMTMuNzQxNiAxMC42NjY3IDEyQzEwLjY2NjcgOS43OTA4NSAxMi40NTc1IDggMTQuNjY2NyA4QzE2Ljg3NTggOCAxOC42NjY2IDkuNzkwODUgMTguNjY2NiAxMkMxOC42NjY2IDEzLjcyNjUgMTcuNTU4OCAxNS4yNTgxIDE1LjkxOTEgMTUuNzk4OFYxOS4yODg4QzE1LjkxOTEgMTkuMzkxOCAxNS45MDY4IDE5LjQ5NDMgMTUuODgyMyAxOS41OTQzTDE5LjUxNTEgMjMuMTU1NUgyNC42NDM1VjIyLjQzNzNDMjQuNjQzNSAyMS43NDQ1IDI1LjIxNjUgMjEuMTgyOSAyNS45MjMzIDIxLjE4MjlIMzguNzIwM0MzOS40MjcgMjEuMTgyOSA0MCAyMS43NDQ1IDQwIDIyLjQzNzNWMjcuNDU1MkM0MCAyOC4xNDgxIDM5LjQyNyAyOC43MDk3IDM4LjcyMDMgMjguNzA5N1pNMjcuMjAzIDM3LjQ5MUgzNy40NDA2VjM0Ljk4MjFIMjcuMjAzVjM3LjQ5MVpNMTQuNDA1OSAyOC4xOTU0TDExLjA5MTUgMjQuOTQ2M0wxNC40MDU5IDIxLjY5NzJMMTcuNzIwNCAyNC45NDYzTDE0LjQwNTkgMjguMTk1NFpNMjcuMjAzIDI2LjIwMDhIMzcuNDQwNlYyMy42OTE4SDI3LjIwM1YyNi4yMDA4WiIgZmlsbD0iIzA3MTQyQSIvPgo8L3N2Zz4K");
|
|
7108
|
+
}
|
|
7109
|
+
.flex-center, .editor-drawio-iframe-container.loading:before {
|
|
7110
|
+
display: flex;
|
|
7111
|
+
align-items: center;
|
|
7112
|
+
justify-content: center;
|
|
7113
|
+
}
|
|
7114
|
+
.full-screen, .editor-drawio-iframe-container.loading:before, .drawio-iframe-element, .editor-drawio-iframe-container {
|
|
7115
|
+
width: 100%;
|
|
7116
|
+
height: 100%;
|
|
7117
|
+
}
|
|
7118
|
+
.editor-drawio-iframe-container {
|
|
7119
|
+
position: fixed;
|
|
7120
|
+
top: 0;
|
|
7121
|
+
left: 0;
|
|
7122
|
+
z-index: 1000;
|
|
7123
|
+
}
|
|
7124
|
+
div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] {
|
|
7125
|
+
outline: 1px solid #dedede;
|
|
7126
|
+
}
|
|
7127
|
+
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio].drawio-load-error > div[data-type=block-content] {
|
|
7128
|
+
padding: 0;
|
|
7129
|
+
min-height: 200px;
|
|
7130
|
+
}
|
|
7131
|
+
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio].drawio-load-error > div[data-type=block-content] .editor-drawio-content {
|
|
7132
|
+
width: 100%;
|
|
7133
|
+
height: 100%;
|
|
7134
|
+
min-height: inherit;
|
|
7135
|
+
}
|
|
7136
|
+
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] {
|
|
7137
|
+
background-color: #fff;
|
|
7138
|
+
justify-content: center;
|
|
7139
|
+
border-radius: 3px;
|
|
7140
|
+
padding: 10px;
|
|
7141
|
+
}
|
|
7142
|
+
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .editor-drawio-content {
|
|
7143
|
+
display: flex;
|
|
7144
|
+
flex-direction: column;
|
|
7145
|
+
align-items: center;
|
|
7146
|
+
justify-content: center;
|
|
7147
|
+
}
|
|
7148
|
+
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .editor-drawio-content > div.drawio-error-content {
|
|
7149
|
+
width: 100%;
|
|
7150
|
+
height: 100%;
|
|
7151
|
+
background-color: #f8f8f8;
|
|
7152
|
+
display: flex;
|
|
7153
|
+
flex-direction: column;
|
|
7154
|
+
justify-content: center;
|
|
7155
|
+
text-align: center;
|
|
7156
|
+
flex: 1;
|
|
7157
|
+
}
|
|
7158
|
+
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .editor-drawio-content > div.drawio-error-content > div.drawio-error-brand-icon > svg {
|
|
7159
|
+
width: 48px;
|
|
7160
|
+
height: 48px;
|
|
7161
|
+
}
|
|
7162
|
+
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .editor-drawio-content > div.drawio-error-content > div.drawio-error-title {
|
|
7163
|
+
font-weight: 500;
|
|
7164
|
+
font-size: 18px;
|
|
7165
|
+
line-height: 26px;
|
|
7166
|
+
text-align: center;
|
|
7167
|
+
color: #303030;
|
|
7168
|
+
margin: 23px 0 5px;
|
|
7169
|
+
}
|
|
7170
|
+
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .editor-drawio-content > div.drawio-error-content > div.drawio-error-sub-title {
|
|
7171
|
+
font-size: 14px;
|
|
7172
|
+
line-height: 22px;
|
|
7173
|
+
text-align: center;
|
|
7174
|
+
color: #606060;
|
|
7175
|
+
}
|
|
7176
|
+
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .editor-drawio-content > div.drawio-error-content > div.drawio-error-sub-title > span.drawio-error-retry-button {
|
|
7177
|
+
cursor: pointer;
|
|
7178
|
+
margin-left: 4px;
|
|
7179
|
+
color: #0064ff;
|
|
7180
|
+
}
|
|
7181
|
+
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .drawio-empty-content {
|
|
7182
|
+
display: flex;
|
|
7183
|
+
flex-direction: column;
|
|
7184
|
+
align-items: center;
|
|
7185
|
+
}
|
|
7186
|
+
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .drawio-empty-content > span {
|
|
7187
|
+
font-size: 14px;
|
|
7188
|
+
line-height: 22px;
|
|
7189
|
+
text-align: center;
|
|
7190
|
+
color: #606060;
|
|
7191
|
+
margin-top: 23px;
|
|
7192
|
+
}
|
|
7193
|
+
.embed-block .editor-drawio-content.editor-embed {
|
|
7194
|
+
width: 100%;
|
|
7195
|
+
min-height: 80px;
|
|
7196
|
+
display: inline-block;
|
|
7197
|
+
text-align: center;
|
|
7198
|
+
}
|
|
7199
|
+
.embed-block .editor-drawio-content.editor-embed .editor-empty-drawio {
|
|
7200
|
+
width: 240px;
|
|
7201
|
+
height: 400px;
|
|
7202
|
+
}
|
|
7203
|
+
div.editor-root div.editor-content div[data-type=editor-container] div[data-embed-type=drawio].embed-block > div[data-type=block-content] img {
|
|
7204
|
+
max-width: 100%;
|
|
7205
|
+
max-height: 100%;
|
|
7206
|
+
}
|
|
7207
|
+
.editor-drawio-iframe-container.loading:before {
|
|
7208
|
+
content: attr(data-placeholder);
|
|
7209
|
+
position: absolute;
|
|
7210
|
+
top: 0;
|
|
7211
|
+
left: 0;
|
|
7212
|
+
background-color: #f7f6f3;
|
|
7213
|
+
z-index: 2;
|
|
7070
7214
|
}.editor-root.readonly [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-column-container.layout-column-container {
|
|
7071
7215
|
background-color: transparent;
|
|
7072
7216
|
}
|
|
@@ -7590,115 +7734,6 @@ div[data-command-bar-id=layout-column-toolbar] .tippy-box .tippy-content button.
|
|
|
7590
7734
|
}
|
|
7591
7735
|
div.editor-root div.editor-content div[data-type=editor-container].root.select-all > .container-blocks > div[data-type=editor-block][data-embed-type=webpage] > div[data-type=block-content]::before {
|
|
7592
7736
|
display: block;
|
|
7593
|
-
}:root {
|
|
7594
|
-
--editor-quoted-color: #7084a4;
|
|
7595
|
-
--editor-drawio-empty-svg: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zOC43MjAzIDI4LjcwOTdIMjUuOTIzM0MyNS4yMTY1IDI4LjcwOTcgMjQuNjQzNSAyOC4xNDgxIDI0LjY0MzUgMjcuNDU1MlYyNS43MzMzSDIwLjUyODNDMjAuNDk4NiAyNS43Njk2IDIwLjQ2NjkgMjUuODA0MiAyMC40MzMzIDI1LjgzN0wxNS45MTkyIDMwLjI2MjFWMzQuNzU1NkgyNC42NDM1VjMzLjcyNzZDMjQuNjQzNSAzMy4wMzQ4IDI1LjIxNjUgMzIuNDczMiAyNS45MjMzIDMyLjQ3MzJIMzguNzIwM0MzOS40MjcgMzIuNDczMiA0MCAzMy4wMzQ4IDQwIDMzLjcyNzZWMzguNzQ1NUM0MCAzOS40MzgzIDM5LjQyNyA0MCAzOC43MjAzIDQwSDI1LjkyMzNDMjUuMjE2NSA0MCAyNC42NDM1IDM5LjQzODMgMjQuNjQzNSAzOC43NDU1VjM3LjMzMzNIMTQuNjI2M0MxMy45MTIyIDM3LjMzMzMgMTMuMzMzMyAzNi43NTYyIDEzLjMzMzMgMzYuMDQ0NFYzMC42OTQxTDguMzc4NTIgMjUuODM3QzguMTM2MjYgMjUuNjAxNCA4IDI1LjI4MDggOCAyNC45NDYzQzggMjQuNjExOCA4LjEzNjI2IDI0LjI5MTEgOC4zNzg1MiAyNC4wNTU2TDEzLjMzMzMgMTkuMTk4NVYxNS43NzJDMTEuNzc5OCAxNS4yMjI5IDEwLjY2NjcgMTMuNzQxNiAxMC42NjY3IDEyQzEwLjY2NjcgOS43OTA4NSAxMi40NTc1IDggMTQuNjY2NyA4QzE2Ljg3NTggOCAxOC42NjY2IDkuNzkwODUgMTguNjY2NiAxMkMxOC42NjY2IDEzLjcyNjUgMTcuNTU4OCAxNS4yNTgxIDE1LjkxOTEgMTUuNzk4OFYxOS4yODg4QzE1LjkxOTEgMTkuMzkxOCAxNS45MDY4IDE5LjQ5NDMgMTUuODgyMyAxOS41OTQzTDE5LjUxNTEgMjMuMTU1NUgyNC42NDM1VjIyLjQzNzNDMjQuNjQzNSAyMS43NDQ1IDI1LjIxNjUgMjEuMTgyOSAyNS45MjMzIDIxLjE4MjlIMzguNzIwM0MzOS40MjcgMjEuMTgyOSA0MCAyMS43NDQ1IDQwIDIyLjQzNzNWMjcuNDU1MkM0MCAyOC4xNDgxIDM5LjQyNyAyOC43MDk3IDM4LjcyMDMgMjguNzA5N1pNMjcuMjAzIDM3LjQ5MUgzNy40NDA2VjM0Ljk4MjFIMjcuMjAzVjM3LjQ5MVpNMTQuNDA1OSAyOC4xOTU0TDExLjA5MTUgMjQuOTQ2M0wxNC40MDU5IDIxLjY5NzJMMTcuNzIwNCAyNC45NDYzTDE0LjQwNTkgMjguMTk1NFpNMjcuMjAzIDI2LjIwMDhIMzcuNDQwNlYyMy42OTE4SDI3LjIwM1YyNi4yMDA4WiIgZmlsbD0iIzA3MTQyQSIvPgo8L3N2Zz4K");
|
|
7596
|
-
}
|
|
7597
|
-
.flex-center, .editor-drawio-iframe-container.loading:before {
|
|
7598
|
-
display: flex;
|
|
7599
|
-
align-items: center;
|
|
7600
|
-
justify-content: center;
|
|
7601
|
-
}
|
|
7602
|
-
.full-screen, .editor-drawio-iframe-container.loading:before, .drawio-iframe-element, .editor-drawio-iframe-container {
|
|
7603
|
-
width: 100%;
|
|
7604
|
-
height: 100%;
|
|
7605
|
-
}
|
|
7606
|
-
.editor-drawio-iframe-container {
|
|
7607
|
-
position: fixed;
|
|
7608
|
-
top: 0;
|
|
7609
|
-
left: 0;
|
|
7610
|
-
z-index: 1000;
|
|
7611
|
-
}
|
|
7612
|
-
div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] {
|
|
7613
|
-
outline: 1px solid #dedede;
|
|
7614
|
-
}
|
|
7615
|
-
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio].drawio-load-error > div[data-type=block-content] {
|
|
7616
|
-
padding: 0;
|
|
7617
|
-
min-height: 200px;
|
|
7618
|
-
}
|
|
7619
|
-
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio].drawio-load-error > div[data-type=block-content] .editor-drawio-content {
|
|
7620
|
-
width: 100%;
|
|
7621
|
-
height: 100%;
|
|
7622
|
-
min-height: inherit;
|
|
7623
|
-
}
|
|
7624
|
-
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] {
|
|
7625
|
-
background-color: #fff;
|
|
7626
|
-
justify-content: center;
|
|
7627
|
-
border-radius: 3px;
|
|
7628
|
-
padding: 10px;
|
|
7629
|
-
}
|
|
7630
|
-
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .editor-drawio-content {
|
|
7631
|
-
display: flex;
|
|
7632
|
-
flex-direction: column;
|
|
7633
|
-
align-items: center;
|
|
7634
|
-
justify-content: center;
|
|
7635
|
-
}
|
|
7636
|
-
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .editor-drawio-content > div.drawio-error-content {
|
|
7637
|
-
width: 100%;
|
|
7638
|
-
height: 100%;
|
|
7639
|
-
background-color: #f8f8f8;
|
|
7640
|
-
display: flex;
|
|
7641
|
-
flex-direction: column;
|
|
7642
|
-
justify-content: center;
|
|
7643
|
-
text-align: center;
|
|
7644
|
-
flex: 1;
|
|
7645
|
-
}
|
|
7646
|
-
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .editor-drawio-content > div.drawio-error-content > div.drawio-error-brand-icon > svg {
|
|
7647
|
-
width: 48px;
|
|
7648
|
-
height: 48px;
|
|
7649
|
-
}
|
|
7650
|
-
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .editor-drawio-content > div.drawio-error-content > div.drawio-error-title {
|
|
7651
|
-
font-weight: 500;
|
|
7652
|
-
font-size: 18px;
|
|
7653
|
-
line-height: 26px;
|
|
7654
|
-
text-align: center;
|
|
7655
|
-
color: #303030;
|
|
7656
|
-
margin: 23px 0 5px;
|
|
7657
|
-
}
|
|
7658
|
-
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .editor-drawio-content > div.drawio-error-content > div.drawio-error-sub-title {
|
|
7659
|
-
font-size: 14px;
|
|
7660
|
-
line-height: 22px;
|
|
7661
|
-
text-align: center;
|
|
7662
|
-
color: #606060;
|
|
7663
|
-
}
|
|
7664
|
-
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .editor-drawio-content > div.drawio-error-content > div.drawio-error-sub-title > span.drawio-error-retry-button {
|
|
7665
|
-
cursor: pointer;
|
|
7666
|
-
margin-left: 4px;
|
|
7667
|
-
color: #0064ff;
|
|
7668
|
-
}
|
|
7669
|
-
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .drawio-empty-content {
|
|
7670
|
-
display: flex;
|
|
7671
|
-
flex-direction: column;
|
|
7672
|
-
align-items: center;
|
|
7673
|
-
}
|
|
7674
|
-
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] .drawio-empty-content > span {
|
|
7675
|
-
font-size: 14px;
|
|
7676
|
-
line-height: 22px;
|
|
7677
|
-
text-align: center;
|
|
7678
|
-
color: #606060;
|
|
7679
|
-
margin-top: 23px;
|
|
7680
|
-
}
|
|
7681
|
-
.embed-block .editor-drawio-content.editor-embed {
|
|
7682
|
-
width: 100%;
|
|
7683
|
-
min-height: 80px;
|
|
7684
|
-
display: inline-block;
|
|
7685
|
-
text-align: center;
|
|
7686
|
-
}
|
|
7687
|
-
.embed-block .editor-drawio-content.editor-embed .editor-empty-drawio {
|
|
7688
|
-
width: 240px;
|
|
7689
|
-
height: 400px;
|
|
7690
|
-
}
|
|
7691
|
-
div.editor-root div.editor-content div[data-type=editor-container] div[data-embed-type=drawio].embed-block > div[data-type=block-content] img {
|
|
7692
|
-
max-width: 100%;
|
|
7693
|
-
max-height: 100%;
|
|
7694
|
-
}
|
|
7695
|
-
.editor-drawio-iframe-container.loading:before {
|
|
7696
|
-
content: attr(data-placeholder);
|
|
7697
|
-
position: absolute;
|
|
7698
|
-
top: 0;
|
|
7699
|
-
left: 0;
|
|
7700
|
-
background-color: #f7f6f3;
|
|
7701
|
-
z-index: 2;
|
|
7702
7737
|
}.editor-content .editing {
|
|
7703
7738
|
background-color: rgba(205, 205, 205, 0.2509803922);
|
|
7704
7739
|
}
|
|
@@ -25882,25 +25917,97 @@ var __publicField = (obj, key, value) => {
|
|
|
25882
25917
|
offset
|
|
25883
25918
|
};
|
|
25884
25919
|
}
|
|
25920
|
+
class BlockAttributesHandler {
|
|
25921
|
+
constructor(editor) {
|
|
25922
|
+
__publicField(this, "textBlockAttributes", /* @__PURE__ */ new Map());
|
|
25923
|
+
__publicField(this, "activeBlockAttributes", /* @__PURE__ */ new Map());
|
|
25924
|
+
__publicField(this, "lastRange");
|
|
25925
|
+
__publicField(this, "clear", () => {
|
|
25926
|
+
this.activeBlockAttributes.clear();
|
|
25927
|
+
});
|
|
25928
|
+
__publicField(this, "handleSelectionChanged", () => {
|
|
25929
|
+
var _a, _b, _c, _d;
|
|
25930
|
+
const range = this.editor.selection.range;
|
|
25931
|
+
if (range.isSimple() && ((_a = this.lastRange) == null ? void 0 : _a.start.blockId) === range.start.blockId && ((_b = this.lastRange) == null ? void 0 : _b.end.blockId) === range.end.blockId && ((_c = this.lastRange) == null ? void 0 : _c.start.offset) === range.start.offset && ((_d = this.lastRange) == null ? void 0 : _d.end.offset) === range.end.offset) {
|
|
25932
|
+
return;
|
|
25933
|
+
}
|
|
25934
|
+
this.lastRange = range;
|
|
25935
|
+
this.clear();
|
|
25936
|
+
});
|
|
25937
|
+
__publicField(this, "setActiveBlockAttributes", (attributes) => {
|
|
25938
|
+
Array.from(this.activeBlockAttributes).forEach(([key, value]) => {
|
|
25939
|
+
const op = { attributes, insert: "" };
|
|
25940
|
+
if (key === "color" || key === "backgroundColor") {
|
|
25941
|
+
if (value === null || value === void 0) {
|
|
25942
|
+
deleteColor(op, key);
|
|
25943
|
+
} else {
|
|
25944
|
+
addColor(op, key, value);
|
|
25945
|
+
}
|
|
25946
|
+
return;
|
|
25947
|
+
}
|
|
25948
|
+
if (!value) {
|
|
25949
|
+
delete attributes[key];
|
|
25950
|
+
} else {
|
|
25951
|
+
const scriptKeys = ["style-sub", "style-super"];
|
|
25952
|
+
if (scriptKeys.includes(key)) {
|
|
25953
|
+
const [another] = scriptKeys.filter((keys) => keys !== key);
|
|
25954
|
+
delete attributes[another];
|
|
25955
|
+
}
|
|
25956
|
+
attributes[key] = value;
|
|
25957
|
+
}
|
|
25958
|
+
});
|
|
25959
|
+
});
|
|
25960
|
+
__publicField(this, "setEmptyBlockTextAttributes", (blockId, attributes) => {
|
|
25961
|
+
this.textBlockAttributes.set(blockId, attributes);
|
|
25962
|
+
});
|
|
25963
|
+
__publicField(this, "setActiveAttribute", (attribute, value) => {
|
|
25964
|
+
this.activeBlockAttributes.set(attribute, value);
|
|
25965
|
+
});
|
|
25966
|
+
this.editor = editor;
|
|
25967
|
+
this.editor.addListener("docChanged", this.clear);
|
|
25968
|
+
this.editor.addListener("selectionChanged", this.handleSelectionChanged);
|
|
25969
|
+
}
|
|
25970
|
+
static get(editor) {
|
|
25971
|
+
return editor.addCustom("BlockAttributesHandler", () => new BlockAttributesHandler(editor));
|
|
25972
|
+
}
|
|
25973
|
+
destroy() {
|
|
25974
|
+
this.editor.removeListener("docChanged", this.clear);
|
|
25975
|
+
this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
|
|
25976
|
+
}
|
|
25977
|
+
getEmptyBlockTextAttributes(blockId) {
|
|
25978
|
+
var _a;
|
|
25979
|
+
const attributes = cloneDeep__default.default((_a = this.textBlockAttributes.get(blockId)) != null ? _a : {});
|
|
25980
|
+
Array.from(Object.entries(attributes)).forEach(([key, value]) => {
|
|
25981
|
+
if (!value) {
|
|
25982
|
+
delete attributes[key];
|
|
25983
|
+
}
|
|
25984
|
+
});
|
|
25985
|
+
this.setActiveBlockAttributes(attributes);
|
|
25986
|
+
if (Object.keys(attributes).length === 0) {
|
|
25987
|
+
return void 0;
|
|
25988
|
+
}
|
|
25989
|
+
return attributes;
|
|
25990
|
+
}
|
|
25991
|
+
}
|
|
25885
25992
|
const logger$3y = getLogger("insert-text");
|
|
25886
25993
|
function getTextAttributes(editor, containerId, blockIndex, offset) {
|
|
25887
|
-
var _a, _b
|
|
25994
|
+
var _a, _b;
|
|
25888
25995
|
const blockData = editor.doc.getBlockData(containerId, blockIndex);
|
|
25889
25996
|
assert(logger$3y, blockData, "no block data");
|
|
25890
25997
|
assert(logger$3y, blockData.text, "no block text");
|
|
25891
25998
|
if (getTextLength(blockData.text) === 0) {
|
|
25892
25999
|
assert(logger$3y, offset === 0, "invalid text offset");
|
|
25893
|
-
return (
|
|
26000
|
+
return BlockAttributesHandler.get(editor).getEmptyBlockTextAttributes(blockData.id);
|
|
25894
26001
|
}
|
|
25895
26002
|
if (offset === 0) {
|
|
25896
26003
|
return void 0;
|
|
25897
26004
|
}
|
|
25898
26005
|
const prev = splitToThree(blockData.text, offset - 1, 1).middle;
|
|
25899
|
-
if ((
|
|
26006
|
+
if ((_a = prev[0].attributes) == null ? void 0 : _a.box) {
|
|
25900
26007
|
return void 0;
|
|
25901
26008
|
}
|
|
25902
|
-
const attributes = (
|
|
25903
|
-
(
|
|
26009
|
+
const attributes = (_b = prev[0].attributes) != null ? _b : {};
|
|
26010
|
+
BlockAttributesHandler.get(editor).setActiveBlockAttributes(attributes);
|
|
25904
26011
|
if (Object.keys(attributes).length === 0) {
|
|
25905
26012
|
return void 0;
|
|
25906
26013
|
}
|
|
@@ -31085,75 +31192,6 @@ ${codeText}
|
|
|
31085
31192
|
const editor = new Editor(parent, doc2, options);
|
|
31086
31193
|
return editor;
|
|
31087
31194
|
}
|
|
31088
|
-
class BlockAttributesHandler {
|
|
31089
|
-
constructor(editor) {
|
|
31090
|
-
__publicField(this, "textBlockAttributes", /* @__PURE__ */ new Map());
|
|
31091
|
-
__publicField(this, "activeBlockAttributes", /* @__PURE__ */ new Map());
|
|
31092
|
-
__publicField(this, "lastRange");
|
|
31093
|
-
__publicField(this, "clear", () => {
|
|
31094
|
-
this.activeBlockAttributes.clear();
|
|
31095
|
-
});
|
|
31096
|
-
__publicField(this, "handleSelectionChanged", () => {
|
|
31097
|
-
var _a, _b, _c, _d;
|
|
31098
|
-
const range = this.editor.selection.range;
|
|
31099
|
-
if (range.isSimple() && ((_a = this.lastRange) == null ? void 0 : _a.start.blockId) === range.start.blockId && ((_b = this.lastRange) == null ? void 0 : _b.end.blockId) === range.end.blockId && ((_c = this.lastRange) == null ? void 0 : _c.start.offset) === range.start.offset && ((_d = this.lastRange) == null ? void 0 : _d.end.offset) === range.end.offset) {
|
|
31100
|
-
return;
|
|
31101
|
-
}
|
|
31102
|
-
this.lastRange = range;
|
|
31103
|
-
this.clear();
|
|
31104
|
-
});
|
|
31105
|
-
__publicField(this, "setActiveBlockAttributes", (attributes) => {
|
|
31106
|
-
Array.from(this.activeBlockAttributes).forEach(([key, value]) => {
|
|
31107
|
-
const op = { attributes, insert: "" };
|
|
31108
|
-
if (key === "color" || key === "backgroundColor") {
|
|
31109
|
-
if (value === null || value === void 0) {
|
|
31110
|
-
deleteColor(op, key);
|
|
31111
|
-
} else {
|
|
31112
|
-
addColor(op, key, value);
|
|
31113
|
-
}
|
|
31114
|
-
return;
|
|
31115
|
-
}
|
|
31116
|
-
if (!value) {
|
|
31117
|
-
delete attributes[key];
|
|
31118
|
-
} else {
|
|
31119
|
-
const scriptKeys = ["style-sub", "style-super"];
|
|
31120
|
-
if (scriptKeys.includes(key)) {
|
|
31121
|
-
const [another] = scriptKeys.filter((keys) => keys !== key);
|
|
31122
|
-
delete attributes[another];
|
|
31123
|
-
}
|
|
31124
|
-
attributes[key] = value;
|
|
31125
|
-
}
|
|
31126
|
-
});
|
|
31127
|
-
});
|
|
31128
|
-
__publicField(this, "setEmptyBlockTextAttributes", (blockId, attributes) => {
|
|
31129
|
-
this.textBlockAttributes.set(blockId, attributes);
|
|
31130
|
-
});
|
|
31131
|
-
__publicField(this, "setActiveAttribute", (attribute, value) => {
|
|
31132
|
-
this.activeBlockAttributes.set(attribute, value);
|
|
31133
|
-
});
|
|
31134
|
-
this.editor = editor;
|
|
31135
|
-
this.editor.addListener("docChanged", this.clear);
|
|
31136
|
-
this.editor.addListener("selectionChanged", this.handleSelectionChanged);
|
|
31137
|
-
}
|
|
31138
|
-
destroy() {
|
|
31139
|
-
this.editor.removeListener("docChanged", this.clear);
|
|
31140
|
-
this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
|
|
31141
|
-
}
|
|
31142
|
-
getEmptyBlockTextAttributes(blockId) {
|
|
31143
|
-
var _a;
|
|
31144
|
-
const attributes = cloneDeep__default.default((_a = this.textBlockAttributes.get(blockId)) != null ? _a : {});
|
|
31145
|
-
Array.from(Object.entries(attributes)).forEach(([key, value]) => {
|
|
31146
|
-
if (!value) {
|
|
31147
|
-
delete attributes[key];
|
|
31148
|
-
}
|
|
31149
|
-
});
|
|
31150
|
-
this.setActiveBlockAttributes(attributes);
|
|
31151
|
-
if (Object.keys(attributes).length === 0) {
|
|
31152
|
-
return void 0;
|
|
31153
|
-
}
|
|
31154
|
-
return attributes;
|
|
31155
|
-
}
|
|
31156
|
-
}
|
|
31157
31195
|
const DefaultColors = ["#B21B57", "#008796", "#7241CC", "#CC4C08", "#5D8F00", "#BD2C1C", "#D17D00"];
|
|
31158
31196
|
class RemoteUsers extends tinyTypedEmitter.TypedEmitter {
|
|
31159
31197
|
constructor(colors) {
|
|
@@ -39646,7 +39684,7 @@ ${codeText}
|
|
|
39646
39684
|
const DownloadIcon$1 = '<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M8.00001 9.2376L8.00006 1L9.00006 1.00001L9.00001 9.2373L12.1299 6.10621L12.8372 6.81318L8.85364 10.7982L8.50009 11.1519L8.14647 10.7983L4.16145 6.81325L4.86855 6.10614L8.00001 9.2376ZM3 13.9434C3 14.2195 3.22386 14.4434 3.5 14.4434L13.5 14.4434C13.7761 14.4434 14 14.2195 14 13.9434V9.94336H15V13.9434C15 14.7718 14.3284 15.4434 13.5 15.4434L3.5 15.4434C2.67157 15.4434 2 14.7718 2 13.9434L2 9.94336H3L3 13.9434Z" fill="currentColor"/>\n</svg>\n';
|
|
39647
39685
|
const alterEmoji = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<circle cx="5" cy="6" r="1" fill="#2D2D2E"/>\n<circle cx="11" cy="6" r="1" fill="#2D2D2E"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M4.12622 9C4.57027 10.7252 6.13637 12 8.0002 12C9.86403 12 11.4301 10.7252 11.8742 9H10.2922C9.90639 9.88294 9.02535 10.5 8.0002 10.5C6.97505 10.5 6.09401 9.88294 5.70823 9H4.12622Z" fill="#2D2D2E"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M14.5 8C14.5 11.5899 11.5899 14.5 8 14.5C4.41015 14.5 1.5 11.5899 1.5 8C1.5 4.41015 4.41015 1.5 8 1.5C8.69781 1.5 9.36994 1.60996 10 1.8135V0.252035C9.36076 0.087506 8.6906 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16C12.4183 16 16 12.4183 16 8C16 7.3094 15.9125 6.63924 15.748 6H14.1865C14.39 6.63006 14.5 7.30219 14.5 8Z" fill="#2D2D2E"/>\n<line x1="12" y1="2.5" x2="15" y2="2.5" stroke="#2D2D2E"/>\n<line x1="13.5" y1="1" x2="13.5" y2="4" stroke="#2D2D2E"/>\n</svg>\n';
|
|
39648
39686
|
const ForbiddenIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8 15C11.866 15 15 11.866 15 8M8 15C4.13401 15 1 11.866 1 8M8 15C11.8324 15 15 11.8324 15 8M8 15C4.16755 15 1 11.8324 1 8M15 8C15 4.13401 11.866 1 8 1M15 8C15 4.16755 11.8324 1 8 1M1 8C1 4.13401 4.13401 1 8 1M1 8C1 4.16755 4.16755 1 8 1M12.9581 12.7581L3.2 3" stroke="currentColor" stroke-width="1" stroke-linecap="square" stroke-linejoin="round"/>\n</svg>\n';
|
|
39649
|
-
const WarningFilledIcon = '<svg width="1em" height="1em" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M14.7768 15.0001H2.22316C1.45534 15.0001 0.973967 14.1706 1.35491 13.5039L7.63174 2.51949C8.01563 1.84767 8.98433 1.84767 9.36822 2.51949L13.6428 10.0001L15.645 13.5039C16.026 14.1706 15.5446 15.0001 14.7768 15.0001ZM8.99998 6.00006V10.0001H7.99998V6.00006H8.99998ZM8.99998 13.0001V11.0001H7.99998V13.0001H8.99998Z" fill="
|
|
39687
|
+
const WarningFilledIcon = '<svg width="1em" height="1em" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M14.7768 15.0001H2.22316C1.45534 15.0001 0.973967 14.1706 1.35491 13.5039L7.63174 2.51949C8.01563 1.84767 8.98433 1.84767 9.36822 2.51949L13.6428 10.0001L15.645 13.5039C16.026 14.1706 15.5446 15.0001 14.7768 15.0001ZM8.99998 6.00006V10.0001H7.99998V6.00006H8.99998ZM8.99998 13.0001V11.0001H7.99998V13.0001H8.99998Z" fill="currentColor"/>\n</svg>\n';
|
|
39650
39688
|
const InformationFilledIcon = '<svg width="1em" height="1em" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M15.5 8C15.5 11.8659 12.3659 15 8.5 15C4.63408 15 1.5 11.8659 1.5 8C1.5 4.13408 4.63408 1 8.5 1C12.3659 1 15.5 4.13408 15.5 8ZM9 7V12H8V7H9ZM9 6V4H8V6H9Z" fill="#0064FF"/>\n</svg>\n';
|
|
39651
39689
|
const AddEmojiIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M13 0V2H11V3H13V5H14V3H16V2H14V0H13ZM8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 7.68424 14.4775 7.37402 14.4341 7.0708L15.4241 6.9292C15.4741 7.27918 15.5 7.63672 15.5 8C15.5 12.1421 12.1421 15.5 8 15.5C3.85786 15.5 0.5 12.1421 0.5 8C0.5 3.85786 3.85786 0.5 8 0.5C8.36328 0.5 8.72082 0.525866 9.0708 0.575927L8.9292 1.56585C8.62598 1.52248 8.31576 1.5 8 1.5ZM6.5 6C6.5 6.55228 6.05228 7 5.5 7C4.94772 7 4.5 6.55228 4.5 6C4.5 5.44772 4.94772 5 5.5 5C6.05228 5 6.5 5.44772 6.5 6ZM10.5 7C11.0523 7 11.5 6.55228 11.5 6C11.5 5.44772 11.0523 5 10.5 5C9.94771 5 9.5 5.44772 9.5 6C9.5 6.55228 9.94771 7 10.5 7ZM5.5 9C5.5 9.21658 5.52742 9.42603 5.57873 9.62537C5.85629 10.7037 6.83579 11.5 8 11.5C9.16421 11.5 10.1437 10.7037 10.4213 9.62537C10.4726 9.42603 10.5 9.21658 10.5 9H11.5C11.5 9.30137 11.4618 9.59454 11.3897 9.87463C11.0012 11.3841 9.63155 12.5 8 12.5C6.36845 12.5 4.9988 11.3841 4.61029 9.87463C4.53821 9.59454 4.5 9.30137 4.5 9H5.5Z" fill="currentColor"/>\n</svg>\n';
|
|
39652
39690
|
const BallIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<mask id="path-1-inside-1_1548_11413" fill="white">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M11.5013 3.3051C10.1794 2.54193 8.68788 2.3389 7.30151 2.62236C7.45689 4.13682 7.15402 5.71323 6.33478 7.13219C5.50852 8.56333 4.11113 9.53449 2.72696 10.1315C3.13679 11.5836 4.09134 12.8834 5.50125 13.6974C6.88859 14.4984 8.46285 14.6824 9.90627 14.3344C9.73444 12.799 10.0339 11.1962 10.8656 9.75572C11.672 8.35905 12.8605 7.31942 14.2224 6.69331C13.7867 5.31322 12.8534 4.08575 11.5013 3.3051ZM14.4471 7.6945C13.3477 8.2443 12.3923 9.11137 11.7316 10.2557C11.049 11.4381 10.78 12.7449 10.8797 14.0101C12.0246 13.5168 13.0262 12.6639 13.6974 11.5013C14.3889 10.3035 14.6205 8.96642 14.4471 7.6945ZM3.3051 5.50125C4.01521 4.2713 5.09503 3.38789 6.32314 2.91033C6.41573 4.16535 6.14557 5.45992 5.46876 6.63219C4.82049 7.75503 3.71484 8.57888 2.53314 9.12317C2.40542 7.90718 2.64699 6.64113 3.3051 5.50125ZM2.43907 5.00125C4.37207 1.6532 8.6532 0.506078 12.0013 2.43907C15.3493 4.37207 16.4964 8.6532 14.5634 12.0013C12.6304 15.3493 8.3493 16.4964 5.00125 14.5634C1.6532 12.6304 0.506078 8.3493 2.43907 5.00125Z"/>\n</mask>\n<path d="M7.30151 2.62236L7.10119 1.64262L6.21435 1.82395L6.30673 2.72442L7.30151 2.62236ZM11.5013 3.3051L11.0013 4.17113L11.5013 3.3051ZM6.33478 7.13219L5.46876 6.63219L6.33478 7.13219ZM2.72696 10.1315L2.33094 9.21321L1.52664 9.56009L1.76455 10.4031L2.72696 10.1315ZM5.50125 13.6974L5.00125 14.5634L5.50125 13.6974ZM9.90627 14.3344L10.1406 15.3066L10.9982 15.0999L10.9001 14.2232L9.90627 14.3344ZM10.8656 9.75572L11.7316 10.2557H11.7316L10.8656 9.75572ZM14.2224 6.69331L14.6401 7.60189L15.4416 7.23343L15.176 6.39225L14.2224 6.69331ZM14.4471 7.6945L15.4379 7.55935L15.2491 6.17528L13.9997 6.80012L14.4471 7.6945ZM11.7316 10.2557L10.8656 9.75572H10.8656L11.7316 10.2557ZM10.8797 14.0101L9.88282 14.0886L9.99256 15.4812L11.2754 14.9285L10.8797 14.0101ZM13.6974 11.5013L12.8314 11.0013L13.6974 11.5013ZM6.32314 2.91033L7.32043 2.83676L7.22095 1.48827L5.96072 1.97831L6.32314 2.91033ZM3.3051 5.50125L2.43907 5.00125H2.43907L3.3051 5.50125ZM5.46876 6.63219L6.33478 7.13219L5.46876 6.63219ZM2.53314 9.12317L1.53861 9.22763L1.68435 10.6151L2.95149 10.0315L2.53314 9.12317ZM12.0013 2.43907L12.5013 1.57305V1.57305L12.0013 2.43907ZM2.43907 5.00125L1.57305 4.50125L2.43907 5.00125ZM5.00125 14.5634L5.50125 13.6974L5.00125 14.5634ZM7.50182 3.60209C8.65795 3.36571 9.89913 3.53482 11.0013 4.17113L12.0013 2.43907C10.4597 1.54905 8.71781 1.31209 7.10119 1.64262L7.50182 3.60209ZM7.20081 7.63219C8.12871 6.02502 8.47241 4.23693 8.29629 2.5203L6.30673 2.72442C6.44137 4.03672 6.17934 5.40143 5.46876 6.63219L7.20081 7.63219ZM3.12298 11.0497C4.62558 10.4017 6.23063 9.31259 7.20081 7.63219L5.46876 6.63219C4.7864 7.81407 3.59667 8.66733 2.33094 9.21321L3.12298 11.0497ZM6.00125 12.8314C4.82601 12.1529 4.03127 11.0713 3.68936 9.85983L1.76455 10.4031C2.24231 12.0959 3.35667 13.6139 5.00125 14.5634L6.00125 12.8314ZM9.67195 13.3623C8.46788 13.6525 7.15776 13.4991 6.00125 12.8314L5.00125 14.5634C6.61943 15.4977 8.45783 15.7122 10.1406 15.3066L9.67195 13.3623ZM10.9001 14.2232C10.7512 12.8926 11.0103 11.5051 11.7316 10.2557L9.99958 9.25572C9.05756 10.8874 8.71771 12.7053 8.91247 14.4457L10.9001 14.2232ZM11.7316 10.2557C12.4311 9.04424 13.4601 8.14438 14.6401 7.60189L13.8047 5.78473C12.2609 6.49445 10.9129 7.67385 9.99958 9.25572L11.7316 10.2557ZM11.0013 4.17113C12.1285 4.82195 12.9054 5.84331 13.2688 6.99437L15.176 6.39225C14.668 4.78312 13.5782 3.34955 12.0013 2.43907L11.0013 4.17113ZM13.9997 6.80012C12.7306 7.43489 11.6272 8.43667 10.8656 9.75572L12.5977 10.7557C13.1575 9.78606 13.9649 9.05372 14.8944 8.58888L13.9997 6.80012ZM10.8656 9.75572C10.0787 11.1187 9.76773 12.6282 9.88282 14.0886L11.8766 13.9315C11.7923 12.8617 12.0193 11.7575 12.5977 10.7557L10.8656 9.75572ZM12.8314 11.0013C12.2714 11.9711 11.438 12.6807 10.4841 13.0917L11.2754 14.9285C12.6112 14.353 13.7809 13.3566 14.5634 12.0013L12.8314 11.0013ZM13.4562 7.82965C13.6008 8.88963 13.4082 10.0022 12.8314 11.0013L14.5634 12.0013C15.3697 10.6048 15.6403 9.0432 15.4379 7.55935L13.4562 7.82965ZM5.96072 1.97831C4.52816 2.53538 3.26705 3.56715 2.43907 5.00125L4.17113 6.00125C4.76337 4.97546 5.6619 4.2404 6.68556 3.84234L5.96072 1.97831ZM6.33478 7.13219C7.11497 5.78087 7.42731 4.28557 7.32043 2.83676L5.32585 2.9839C5.40414 4.04514 5.17618 5.13896 4.60273 6.13219L6.33478 7.13219ZM2.95149 10.0315C4.24894 9.43386 5.54945 8.49242 6.33478 7.13219L4.60273 6.13219C4.09152 7.01764 3.18075 7.72391 2.11479 8.21488L2.95149 10.0315ZM2.43907 5.00125C1.6719 6.33004 1.38957 7.80869 1.53861 9.22763L3.52767 9.01871C3.42126 8.00567 3.62209 6.95221 4.17113 6.00125L2.43907 5.00125ZM12.5013 1.57305C8.67491 -0.63609 3.78219 0.674911 1.57305 4.50125L3.3051 5.50125C4.96195 2.6315 8.6315 1.64825 11.5013 3.3051L12.5013 1.57305ZM15.4295 12.5013C17.6386 8.67491 16.3276 3.78219 12.5013 1.57305L11.5013 3.3051C14.371 4.96195 15.3543 8.6315 13.6974 11.5013L15.4295 12.5013ZM4.50125 15.4295C8.32759 17.6386 13.2203 16.3276 15.4295 12.5013L13.6974 11.5013C12.0406 14.371 8.37101 15.3543 5.50125 13.6974L4.50125 15.4295ZM1.57305 4.50125C-0.63609 8.32759 0.674911 13.2203 4.50125 15.4295L5.50125 13.6974C2.6315 12.0406 1.64825 8.37101 3.3051 5.50125L1.57305 4.50125Z" fill="currentColor" mask="url(#path-1-inside-1_1548_11413)"/>\n</svg>\n';
|
|
@@ -40842,10 +40880,11 @@ ${codeText}
|
|
|
40842
40880
|
}
|
|
40843
40881
|
}
|
|
40844
40882
|
const list = "";
|
|
40845
|
-
const toast = "";
|
|
40883
|
+
const toast$1 = "";
|
|
40846
40884
|
function showToast(text2, options) {
|
|
40885
|
+
var _a;
|
|
40847
40886
|
const toast2 = document.createElement("div");
|
|
40848
|
-
toast2.classList.add("toast", "show");
|
|
40887
|
+
toast2.classList.add("ones-editor-toast", "show");
|
|
40849
40888
|
if (options == null ? void 0 : options.theme) {
|
|
40850
40889
|
toast2.setAttribute("data-theme", options.theme);
|
|
40851
40890
|
}
|
|
@@ -40862,293 +40901,303 @@ ${codeText}
|
|
|
40862
40901
|
toast2.style.top = `${options.position.y}px`;
|
|
40863
40902
|
toast2.classList.add("positioned");
|
|
40864
40903
|
}
|
|
40865
|
-
|
|
40866
|
-
setTimeout(() => {
|
|
40904
|
+
const exit = () => {
|
|
40867
40905
|
toast2.classList.remove("show");
|
|
40868
40906
|
setTimeout(() => {
|
|
40869
40907
|
toast2.remove();
|
|
40870
40908
|
}, 500);
|
|
40871
|
-
}
|
|
40872
|
-
|
|
40873
|
-
|
|
40874
|
-
|
|
40875
|
-
|
|
40876
|
-
|
|
40877
|
-
return;
|
|
40878
|
-
}
|
|
40879
|
-
if (item.type === "section") {
|
|
40880
|
-
const nameElem = createElement("div", ["section-name"], null, item.name);
|
|
40881
|
-
elem.appendChild(nameElem);
|
|
40882
|
-
} else if (item.type === "separator")
|
|
40883
|
-
;
|
|
40884
|
-
else {
|
|
40885
|
-
if (item.icon) {
|
|
40886
|
-
const menuItemIcon = createElement("div", ["menu-item-icon"], null);
|
|
40887
|
-
if (item.icon) {
|
|
40888
|
-
menuItemIcon.innerHTML = item.icon;
|
|
40889
|
-
}
|
|
40890
|
-
elem.appendChild(menuItemIcon);
|
|
40891
|
-
}
|
|
40892
|
-
const menuItemName = createElement("div", ["menu-item-name", "text"], null);
|
|
40893
|
-
createElement("span", [], menuItemName, item.name);
|
|
40894
|
-
if (item.ellipsisTooltip) {
|
|
40895
|
-
elem.setAttribute("data-editor-tooltip-allow-markdown", "true");
|
|
40896
|
-
elem.setAttribute("data-editor-tooltip-offset-y", "25");
|
|
40897
|
-
elem.setAttribute("data-editor-tooltip-placement", "right");
|
|
40898
|
-
elem.setAttribute("data-editor-tooltip-common", `<div style="word-break: break-word;">${item.ellipsisTooltip}</div>`);
|
|
40899
|
-
}
|
|
40900
|
-
if (((_a = item.states) == null ? void 0 : _a.includes("disabled")) && item.disableReason) {
|
|
40901
|
-
elem.setAttribute("data-editor-tooltip-placement", "right");
|
|
40902
|
-
elem.setAttribute("data-editor-tooltip-common", item.disableReason);
|
|
40903
|
-
}
|
|
40904
|
-
elem.appendChild(menuItemName);
|
|
40905
|
-
if (item.subText) {
|
|
40906
|
-
createElement("div", ["item-subtext", "text"], elem, item.subText);
|
|
40907
|
-
}
|
|
40908
|
-
if (item.children && !item.element) {
|
|
40909
|
-
const subIndicator = createElement("div", ["menu-item-sub-indicator"], null);
|
|
40910
|
-
subIndicator.innerHTML = ArrowRightIcon;
|
|
40911
|
-
elem.appendChild(subIndicator);
|
|
40912
|
-
}
|
|
40913
|
-
if ((_b = item.states) == null ? void 0 : _b.includes("checked")) {
|
|
40914
|
-
const checkedIcon = createElement("div", ["menu-item-checked-icon"], null);
|
|
40915
|
-
checkedIcon.innerHTML = CheckMarkIcon;
|
|
40916
|
-
elem.appendChild(checkedIcon);
|
|
40917
|
-
}
|
|
40918
|
-
}
|
|
40919
|
-
}
|
|
40920
|
-
class ManualMenu extends ManualCommandBar {
|
|
40921
|
-
constructor(items, closeable, options) {
|
|
40922
|
-
super(items, closeable, {
|
|
40923
|
-
autoClose: true,
|
|
40924
|
-
disablePageScroll: true,
|
|
40925
|
-
beforeClose: options == null ? void 0 : options.beforeClose,
|
|
40926
|
-
...options
|
|
40927
|
-
});
|
|
40928
|
-
}
|
|
40929
|
-
manualShow(target, options) {
|
|
40930
|
-
const newOptions = {
|
|
40931
|
-
theme: "menu",
|
|
40932
|
-
...options
|
|
40933
|
-
};
|
|
40934
|
-
super.manualShow(target, newOptions);
|
|
40935
|
-
}
|
|
40936
|
-
initCommandBarElement(elem) {
|
|
40937
|
-
addClass(elem, "menu");
|
|
40938
|
-
}
|
|
40939
|
-
initItemElement(item, elem) {
|
|
40940
|
-
initMenuItem$1(item, elem);
|
|
40941
|
-
}
|
|
40942
|
-
}
|
|
40943
|
-
function createManualMenu(parentItem, closeable, options) {
|
|
40944
|
-
var _a;
|
|
40945
|
-
return new ManualMenu((_a = parentItem.children) != null ? _a : [], closeable, {
|
|
40946
|
-
...options,
|
|
40947
|
-
parentItem
|
|
40948
|
-
});
|
|
40949
|
-
}
|
|
40950
|
-
function initToolbarItem(item, elem, options) {
|
|
40951
|
-
elem.setAttribute("data-button-id", item.id);
|
|
40952
|
-
if (options.tooltipId && item.name && !item.disableTooltip) {
|
|
40953
|
-
elem.setAttribute(`data-editor-tooltip-${options.tooltipId}`, item.name);
|
|
40954
|
-
if (item.desc) {
|
|
40955
|
-
elem.setAttribute(`data-editor-tooltip-desc-${options.tooltipId}`, item.desc);
|
|
40956
|
-
}
|
|
40957
|
-
if (item.tooltipPlacement) {
|
|
40958
|
-
elem.setAttribute("data-editor-tooltip-placement", item.tooltipPlacement);
|
|
40959
|
-
}
|
|
40960
|
-
}
|
|
40961
|
-
const button2 = elem;
|
|
40962
|
-
if (!item.element) {
|
|
40963
|
-
if (item.icon && !options.showName) {
|
|
40964
|
-
const icon = createElement("span", ["toolbar-item-icon-container"], button2);
|
|
40965
|
-
if (item.icon.trim().startsWith("<")) {
|
|
40966
|
-
icon.innerHTML = item.icon;
|
|
40967
|
-
} else {
|
|
40968
|
-
icon.innerText = item.icon;
|
|
40969
|
-
}
|
|
40970
|
-
} else {
|
|
40971
|
-
const name = createElement("span", ["toolbar-item-name-container"], button2);
|
|
40972
|
-
name.innerText = item.name;
|
|
40973
|
-
}
|
|
40974
|
-
}
|
|
40975
|
-
if (item.dropdown) {
|
|
40976
|
-
elem.setAttribute("data-dropdown", "true");
|
|
40977
|
-
const dropdown2 = createElement("span", ["toolbar-item-dropdown-container"], button2);
|
|
40978
|
-
dropdown2.innerHTML = ArrowDownIcon$1;
|
|
40979
|
-
if (item.dropSplit) {
|
|
40980
|
-
addClass(button2, "toolbar-item-drop-split");
|
|
40981
|
-
if (item.splitTooltip) {
|
|
40982
|
-
elem.removeAttribute(`data-editor-tooltip-${options.tooltipId}`);
|
|
40983
|
-
dropdown2.setAttribute(`data-editor-tooltip-${options.tooltipId}`, item.splitTooltip);
|
|
40984
|
-
}
|
|
40985
|
-
}
|
|
40986
|
-
}
|
|
40987
|
-
if (item.states) {
|
|
40988
|
-
if (item.states.indexOf("checked") !== -1) {
|
|
40989
|
-
addClass(button2, "checked");
|
|
40990
|
-
}
|
|
40991
|
-
if (item.states.indexOf("disabled") !== -1) {
|
|
40992
|
-
button2.disabled = true;
|
|
40993
|
-
}
|
|
40994
|
-
}
|
|
40995
|
-
}
|
|
40996
|
-
class ManualToolbar extends ManualCommandBar {
|
|
40997
|
-
constructor(items, closeable, options) {
|
|
40998
|
-
super(items, closeable, {
|
|
40999
|
-
itemElementTag: "button",
|
|
41000
|
-
tippyArrow: false,
|
|
41001
|
-
maxWidth: clientType.isMobile ? "90vw" : "max-content",
|
|
41002
|
-
...options
|
|
41003
|
-
});
|
|
41004
|
-
}
|
|
41005
|
-
getSubBarOptions(item) {
|
|
41006
|
-
var _a, _b;
|
|
41007
|
-
const getReferenceClientRect2 = () => {
|
|
41008
|
-
const elem = this.getItemElementById(item.id);
|
|
41009
|
-
const content = this.content;
|
|
41010
|
-
const contentRect = content.getBoundingClientRect();
|
|
41011
|
-
const elemRect = elem.getBoundingClientRect();
|
|
41012
|
-
return new DOMRect(elemRect.left, contentRect.top, elemRect.width, contentRect.height);
|
|
41013
|
-
};
|
|
41014
|
-
const options = {
|
|
41015
|
-
placement: (_a = item.childrenPlacement) != null ? _a : "top",
|
|
41016
|
-
getReferenceClientRect: getReferenceClientRect2,
|
|
41017
|
-
offset: (_b = item.childrenOffset) != null ? _b : [0, 4]
|
|
41018
|
-
};
|
|
41019
|
-
return options;
|
|
41020
|
-
}
|
|
41021
|
-
manualShow(target, options) {
|
|
41022
|
-
const newOptions = {
|
|
41023
|
-
theme: "toolbar",
|
|
41024
|
-
...options
|
|
41025
|
-
};
|
|
41026
|
-
super.manualShow(target, newOptions);
|
|
41027
|
-
}
|
|
41028
|
-
initCommandBarElement(elem) {
|
|
41029
|
-
addClass(elem, "toolbar");
|
|
41030
|
-
if (clientType.isMobile) {
|
|
41031
|
-
addClass(elem, "mobile");
|
|
41032
|
-
}
|
|
41033
|
-
}
|
|
41034
|
-
initItemElement(item, elem) {
|
|
41035
|
-
initToolbarItem(item, elem, this.options);
|
|
41036
|
-
}
|
|
41037
|
-
}
|
|
41038
|
-
function createManualToolbar(parentItem, closeable, options) {
|
|
41039
|
-
var _a;
|
|
41040
|
-
return new ManualToolbar((_a = parentItem.children) != null ? _a : [], closeable, {
|
|
41041
|
-
...options,
|
|
41042
|
-
parentItem
|
|
41043
|
-
});
|
|
41044
|
-
}
|
|
41045
|
-
class FixedToolbar extends CommandBar {
|
|
41046
|
-
constructor(parent, items, options) {
|
|
41047
|
-
super(items, void 0, options);
|
|
41048
|
-
__publicField(this, "handleDocumentKeydown", (event) => {
|
|
41049
|
-
if (!this.isVisible) {
|
|
41050
|
-
return true;
|
|
41051
|
-
}
|
|
41052
|
-
if (event.isComposing) {
|
|
41053
|
-
return true;
|
|
41054
|
-
}
|
|
41055
|
-
if (this.subBar) {
|
|
41056
|
-
return this.subBar.handleDocumentKeydown(event);
|
|
41057
|
-
}
|
|
41058
|
-
return true;
|
|
41059
|
-
});
|
|
41060
|
-
__publicField(this, "getSubBarOptions", (item) => {
|
|
41061
|
-
var _a;
|
|
41062
|
-
const options = {
|
|
41063
|
-
placement: (_a = item.childrenPlacement) != null ? _a : "right-start",
|
|
41064
|
-
offset: item.childrenOffset
|
|
41065
|
-
};
|
|
41066
|
-
return options;
|
|
41067
|
-
});
|
|
41068
|
-
parent.appendChild(this.content);
|
|
41069
|
-
document.addEventListener("keydown", this.handleDocumentKeydown);
|
|
41070
|
-
if (clientType.isMobile) {
|
|
41071
|
-
document.addEventListener("touchend", this.handleDocumentMouseDown);
|
|
41072
|
-
} else {
|
|
41073
|
-
document.addEventListener("mousedown", this.handleDocumentMouseDown);
|
|
41074
|
-
}
|
|
41075
|
-
}
|
|
41076
|
-
initCommandBarElement(elem) {
|
|
41077
|
-
addClass(elem, "toolbar", "fixed");
|
|
41078
|
-
if (clientType.isMobile) {
|
|
41079
|
-
addClass(elem, "mobile");
|
|
41080
|
-
}
|
|
41081
|
-
}
|
|
41082
|
-
initItemElement(item, elem) {
|
|
41083
|
-
initToolbarItem(item, elem, this.options);
|
|
41084
|
-
}
|
|
41085
|
-
close() {
|
|
41086
|
-
this.clearSelectedItem();
|
|
41087
|
-
if (this.subBar) {
|
|
41088
|
-
this.subBar.close("cancelBar");
|
|
41089
|
-
this.subBar = null;
|
|
41090
|
-
}
|
|
41091
|
-
}
|
|
41092
|
-
destroy() {
|
|
41093
|
-
this.content.remove();
|
|
41094
|
-
super.destroy();
|
|
41095
|
-
document.removeEventListener("keydown", this.handleDocumentKeydown);
|
|
41096
|
-
document.removeEventListener("mousedown", this.handleDocumentMouseDown);
|
|
41097
|
-
document.removeEventListener("touchend", this.handleDocumentMouseDown);
|
|
41098
|
-
}
|
|
41099
|
-
getCommandBarRoot() {
|
|
41100
|
-
return this.content.parentElement;
|
|
41101
|
-
}
|
|
41102
|
-
get isVisible() {
|
|
41103
|
-
return true;
|
|
41104
|
-
}
|
|
41105
|
-
}
|
|
41106
|
-
const commandBar = "";
|
|
41107
|
-
CommandBar.registerManualCommandBar("menu", createManualMenu);
|
|
41108
|
-
CommandBar.registerManualCommandBar("toolbar", createManualToolbar);
|
|
41109
|
-
const light = "";
|
|
41110
|
-
const logger$2B = getLogger("ui-base");
|
|
41111
|
-
class ManualCloseDialog extends ManualCommandBar {
|
|
41112
|
-
constructor(content, options) {
|
|
41113
|
-
super(ManualCloseDialog.getCommandItems(content, options), void 0, {
|
|
41114
|
-
disablePageScroll: true,
|
|
41115
|
-
...options
|
|
41116
|
-
});
|
|
41117
|
-
__publicField(this, "handleDocumentMouseDown", () => {
|
|
41118
|
-
});
|
|
41119
|
-
}
|
|
41120
|
-
initCommandBarElement(elem) {
|
|
41121
|
-
addClass(elem, "dialog", "manual");
|
|
41122
|
-
}
|
|
41123
|
-
initItemElement(item, elem) {
|
|
41124
|
-
}
|
|
41125
|
-
show(target, options) {
|
|
41126
|
-
this.manualShow(target, {
|
|
41127
|
-
...options,
|
|
41128
|
-
theme: "light"
|
|
41129
|
-
});
|
|
41130
|
-
}
|
|
41131
|
-
get dialogContent() {
|
|
41132
|
-
const item = this.items[0];
|
|
41133
|
-
assert(logger$2B, item, "no dialog item");
|
|
41134
|
-
const content = item.element;
|
|
41135
|
-
assert(logger$2B, content, "no item element");
|
|
41136
|
-
return content;
|
|
40909
|
+
};
|
|
40910
|
+
const autoClose = (_a = options == null ? void 0 : options.autoClose) != null ? _a : true;
|
|
40911
|
+
if (!autoClose) {
|
|
40912
|
+
const icon = createElement("span", ["close"], toast2);
|
|
40913
|
+
icon.innerHTML = CloseIcon;
|
|
40914
|
+
icon.onclick = exit;
|
|
41137
40915
|
}
|
|
41138
|
-
|
|
41139
|
-
|
|
41140
|
-
|
|
41141
|
-
const items = [{
|
|
41142
|
-
id,
|
|
41143
|
-
name: "",
|
|
41144
|
-
element: content
|
|
41145
|
-
}];
|
|
41146
|
-
return items;
|
|
40916
|
+
document.body.appendChild(toast2);
|
|
40917
|
+
if (options == null ? void 0 : options.autoClose) {
|
|
40918
|
+
setTimeout(() => exit(), (options == null ? void 0 : options.duration) || 3e3);
|
|
41147
40919
|
}
|
|
40920
|
+
return exit;
|
|
41148
40921
|
}
|
|
41149
|
-
|
|
41150
|
-
|
|
41151
|
-
|
|
40922
|
+
function initMenuItem$1(item, elem) {
|
|
40923
|
+
var _a, _b;
|
|
40924
|
+
addClass(elem, "menu-item");
|
|
40925
|
+
if (item.element) {
|
|
40926
|
+
return;
|
|
40927
|
+
}
|
|
40928
|
+
if (item.type === "section") {
|
|
40929
|
+
const nameElem = createElement("div", ["section-name"], null, item.name);
|
|
40930
|
+
elem.appendChild(nameElem);
|
|
40931
|
+
} else if (item.type === "separator")
|
|
40932
|
+
;
|
|
40933
|
+
else {
|
|
40934
|
+
if (item.icon) {
|
|
40935
|
+
const menuItemIcon = createElement("div", ["menu-item-icon"], null);
|
|
40936
|
+
if (item.icon) {
|
|
40937
|
+
menuItemIcon.innerHTML = item.icon;
|
|
40938
|
+
}
|
|
40939
|
+
elem.appendChild(menuItemIcon);
|
|
40940
|
+
}
|
|
40941
|
+
const menuItemName = createElement("div", ["menu-item-name", "text"], null);
|
|
40942
|
+
createElement("span", [], menuItemName, item.name);
|
|
40943
|
+
if (item.ellipsisTooltip) {
|
|
40944
|
+
elem.setAttribute("data-editor-tooltip-allow-markdown", "true");
|
|
40945
|
+
elem.setAttribute("data-editor-tooltip-offset-y", "25");
|
|
40946
|
+
elem.setAttribute("data-editor-tooltip-placement", "right");
|
|
40947
|
+
elem.setAttribute("data-editor-tooltip-common", `<div style="word-break: break-word;">${item.ellipsisTooltip}</div>`);
|
|
40948
|
+
}
|
|
40949
|
+
if (((_a = item.states) == null ? void 0 : _a.includes("disabled")) && item.disableReason) {
|
|
40950
|
+
elem.setAttribute("data-editor-tooltip-placement", "right");
|
|
40951
|
+
elem.setAttribute("data-editor-tooltip-common", item.disableReason);
|
|
40952
|
+
}
|
|
40953
|
+
elem.appendChild(menuItemName);
|
|
40954
|
+
if (item.subText) {
|
|
40955
|
+
createElement("div", ["item-subtext", "text"], elem, item.subText);
|
|
40956
|
+
}
|
|
40957
|
+
if (item.children && !item.element) {
|
|
40958
|
+
const subIndicator = createElement("div", ["menu-item-sub-indicator"], null);
|
|
40959
|
+
subIndicator.innerHTML = ArrowRightIcon;
|
|
40960
|
+
elem.appendChild(subIndicator);
|
|
40961
|
+
}
|
|
40962
|
+
if ((_b = item.states) == null ? void 0 : _b.includes("checked")) {
|
|
40963
|
+
const checkedIcon = createElement("div", ["menu-item-checked-icon"], null);
|
|
40964
|
+
checkedIcon.innerHTML = CheckMarkIcon;
|
|
40965
|
+
elem.appendChild(checkedIcon);
|
|
40966
|
+
}
|
|
40967
|
+
}
|
|
40968
|
+
}
|
|
40969
|
+
class ManualMenu extends ManualCommandBar {
|
|
40970
|
+
constructor(items, closeable, options) {
|
|
40971
|
+
super(items, closeable, {
|
|
40972
|
+
autoClose: true,
|
|
40973
|
+
disablePageScroll: true,
|
|
40974
|
+
beforeClose: options == null ? void 0 : options.beforeClose,
|
|
40975
|
+
...options
|
|
40976
|
+
});
|
|
40977
|
+
}
|
|
40978
|
+
manualShow(target, options) {
|
|
40979
|
+
const newOptions = {
|
|
40980
|
+
theme: "menu",
|
|
40981
|
+
...options
|
|
40982
|
+
};
|
|
40983
|
+
super.manualShow(target, newOptions);
|
|
40984
|
+
}
|
|
40985
|
+
initCommandBarElement(elem) {
|
|
40986
|
+
addClass(elem, "menu");
|
|
40987
|
+
}
|
|
40988
|
+
initItemElement(item, elem) {
|
|
40989
|
+
initMenuItem$1(item, elem);
|
|
40990
|
+
}
|
|
40991
|
+
}
|
|
40992
|
+
function createManualMenu(parentItem, closeable, options) {
|
|
40993
|
+
var _a;
|
|
40994
|
+
return new ManualMenu((_a = parentItem.children) != null ? _a : [], closeable, {
|
|
40995
|
+
...options,
|
|
40996
|
+
parentItem
|
|
40997
|
+
});
|
|
40998
|
+
}
|
|
40999
|
+
function initToolbarItem(item, elem, options) {
|
|
41000
|
+
elem.setAttribute("data-button-id", item.id);
|
|
41001
|
+
if (options.tooltipId && item.name && !item.disableTooltip) {
|
|
41002
|
+
elem.setAttribute(`data-editor-tooltip-${options.tooltipId}`, item.name);
|
|
41003
|
+
if (item.desc) {
|
|
41004
|
+
elem.setAttribute(`data-editor-tooltip-desc-${options.tooltipId}`, item.desc);
|
|
41005
|
+
}
|
|
41006
|
+
if (item.tooltipPlacement) {
|
|
41007
|
+
elem.setAttribute("data-editor-tooltip-placement", item.tooltipPlacement);
|
|
41008
|
+
}
|
|
41009
|
+
}
|
|
41010
|
+
const button2 = elem;
|
|
41011
|
+
if (!item.element) {
|
|
41012
|
+
if (item.icon && !options.showName) {
|
|
41013
|
+
const icon = createElement("span", ["toolbar-item-icon-container"], button2);
|
|
41014
|
+
if (item.icon.trim().startsWith("<")) {
|
|
41015
|
+
icon.innerHTML = item.icon;
|
|
41016
|
+
} else {
|
|
41017
|
+
icon.innerText = item.icon;
|
|
41018
|
+
}
|
|
41019
|
+
} else {
|
|
41020
|
+
const name = createElement("span", ["toolbar-item-name-container"], button2);
|
|
41021
|
+
name.innerText = item.name;
|
|
41022
|
+
}
|
|
41023
|
+
}
|
|
41024
|
+
if (item.dropdown) {
|
|
41025
|
+
elem.setAttribute("data-dropdown", "true");
|
|
41026
|
+
const dropdown2 = createElement("span", ["toolbar-item-dropdown-container"], button2);
|
|
41027
|
+
dropdown2.innerHTML = ArrowDownIcon$1;
|
|
41028
|
+
if (item.dropSplit) {
|
|
41029
|
+
addClass(button2, "toolbar-item-drop-split");
|
|
41030
|
+
if (item.splitTooltip) {
|
|
41031
|
+
elem.removeAttribute(`data-editor-tooltip-${options.tooltipId}`);
|
|
41032
|
+
dropdown2.setAttribute(`data-editor-tooltip-${options.tooltipId}`, item.splitTooltip);
|
|
41033
|
+
}
|
|
41034
|
+
}
|
|
41035
|
+
}
|
|
41036
|
+
if (item.states) {
|
|
41037
|
+
if (item.states.indexOf("checked") !== -1) {
|
|
41038
|
+
addClass(button2, "checked");
|
|
41039
|
+
}
|
|
41040
|
+
if (item.states.indexOf("disabled") !== -1) {
|
|
41041
|
+
button2.disabled = true;
|
|
41042
|
+
}
|
|
41043
|
+
}
|
|
41044
|
+
}
|
|
41045
|
+
class ManualToolbar extends ManualCommandBar {
|
|
41046
|
+
constructor(items, closeable, options) {
|
|
41047
|
+
super(items, closeable, {
|
|
41048
|
+
itemElementTag: "button",
|
|
41049
|
+
tippyArrow: false,
|
|
41050
|
+
maxWidth: clientType.isMobile ? "90vw" : "max-content",
|
|
41051
|
+
...options
|
|
41052
|
+
});
|
|
41053
|
+
}
|
|
41054
|
+
getSubBarOptions(item) {
|
|
41055
|
+
var _a, _b;
|
|
41056
|
+
const getReferenceClientRect2 = () => {
|
|
41057
|
+
const elem = this.getItemElementById(item.id);
|
|
41058
|
+
const content = this.content;
|
|
41059
|
+
const contentRect = content.getBoundingClientRect();
|
|
41060
|
+
const elemRect = elem.getBoundingClientRect();
|
|
41061
|
+
return new DOMRect(elemRect.left, contentRect.top, elemRect.width, contentRect.height);
|
|
41062
|
+
};
|
|
41063
|
+
const options = {
|
|
41064
|
+
placement: (_a = item.childrenPlacement) != null ? _a : "top",
|
|
41065
|
+
getReferenceClientRect: getReferenceClientRect2,
|
|
41066
|
+
offset: (_b = item.childrenOffset) != null ? _b : [0, 4]
|
|
41067
|
+
};
|
|
41068
|
+
return options;
|
|
41069
|
+
}
|
|
41070
|
+
manualShow(target, options) {
|
|
41071
|
+
const newOptions = {
|
|
41072
|
+
theme: "toolbar",
|
|
41073
|
+
...options
|
|
41074
|
+
};
|
|
41075
|
+
super.manualShow(target, newOptions);
|
|
41076
|
+
}
|
|
41077
|
+
initCommandBarElement(elem) {
|
|
41078
|
+
addClass(elem, "toolbar");
|
|
41079
|
+
if (clientType.isMobile) {
|
|
41080
|
+
addClass(elem, "mobile");
|
|
41081
|
+
}
|
|
41082
|
+
}
|
|
41083
|
+
initItemElement(item, elem) {
|
|
41084
|
+
initToolbarItem(item, elem, this.options);
|
|
41085
|
+
}
|
|
41086
|
+
}
|
|
41087
|
+
function createManualToolbar(parentItem, closeable, options) {
|
|
41088
|
+
var _a;
|
|
41089
|
+
return new ManualToolbar((_a = parentItem.children) != null ? _a : [], closeable, {
|
|
41090
|
+
...options,
|
|
41091
|
+
parentItem
|
|
41092
|
+
});
|
|
41093
|
+
}
|
|
41094
|
+
class FixedToolbar extends CommandBar {
|
|
41095
|
+
constructor(parent, items, options) {
|
|
41096
|
+
super(items, void 0, options);
|
|
41097
|
+
__publicField(this, "handleDocumentKeydown", (event) => {
|
|
41098
|
+
if (!this.isVisible) {
|
|
41099
|
+
return true;
|
|
41100
|
+
}
|
|
41101
|
+
if (event.isComposing) {
|
|
41102
|
+
return true;
|
|
41103
|
+
}
|
|
41104
|
+
if (this.subBar) {
|
|
41105
|
+
return this.subBar.handleDocumentKeydown(event);
|
|
41106
|
+
}
|
|
41107
|
+
return true;
|
|
41108
|
+
});
|
|
41109
|
+
__publicField(this, "getSubBarOptions", (item) => {
|
|
41110
|
+
var _a;
|
|
41111
|
+
const options = {
|
|
41112
|
+
placement: (_a = item.childrenPlacement) != null ? _a : "right-start",
|
|
41113
|
+
offset: item.childrenOffset
|
|
41114
|
+
};
|
|
41115
|
+
return options;
|
|
41116
|
+
});
|
|
41117
|
+
parent.appendChild(this.content);
|
|
41118
|
+
document.addEventListener("keydown", this.handleDocumentKeydown);
|
|
41119
|
+
if (clientType.isMobile) {
|
|
41120
|
+
document.addEventListener("touchend", this.handleDocumentMouseDown);
|
|
41121
|
+
} else {
|
|
41122
|
+
document.addEventListener("mousedown", this.handleDocumentMouseDown);
|
|
41123
|
+
}
|
|
41124
|
+
}
|
|
41125
|
+
initCommandBarElement(elem) {
|
|
41126
|
+
addClass(elem, "toolbar", "fixed");
|
|
41127
|
+
if (clientType.isMobile) {
|
|
41128
|
+
addClass(elem, "mobile");
|
|
41129
|
+
}
|
|
41130
|
+
}
|
|
41131
|
+
initItemElement(item, elem) {
|
|
41132
|
+
initToolbarItem(item, elem, this.options);
|
|
41133
|
+
}
|
|
41134
|
+
close() {
|
|
41135
|
+
this.clearSelectedItem();
|
|
41136
|
+
if (this.subBar) {
|
|
41137
|
+
this.subBar.close("cancelBar");
|
|
41138
|
+
this.subBar = null;
|
|
41139
|
+
}
|
|
41140
|
+
}
|
|
41141
|
+
destroy() {
|
|
41142
|
+
this.content.remove();
|
|
41143
|
+
super.destroy();
|
|
41144
|
+
document.removeEventListener("keydown", this.handleDocumentKeydown);
|
|
41145
|
+
document.removeEventListener("mousedown", this.handleDocumentMouseDown);
|
|
41146
|
+
document.removeEventListener("touchend", this.handleDocumentMouseDown);
|
|
41147
|
+
}
|
|
41148
|
+
getCommandBarRoot() {
|
|
41149
|
+
return this.content.parentElement;
|
|
41150
|
+
}
|
|
41151
|
+
get isVisible() {
|
|
41152
|
+
return true;
|
|
41153
|
+
}
|
|
41154
|
+
}
|
|
41155
|
+
const commandBar = "";
|
|
41156
|
+
CommandBar.registerManualCommandBar("menu", createManualMenu);
|
|
41157
|
+
CommandBar.registerManualCommandBar("toolbar", createManualToolbar);
|
|
41158
|
+
const light = "";
|
|
41159
|
+
const logger$2B = getLogger("ui-base");
|
|
41160
|
+
class ManualCloseDialog extends ManualCommandBar {
|
|
41161
|
+
constructor(content, options) {
|
|
41162
|
+
super(ManualCloseDialog.getCommandItems(content, options), void 0, {
|
|
41163
|
+
disablePageScroll: true,
|
|
41164
|
+
...options
|
|
41165
|
+
});
|
|
41166
|
+
__publicField(this, "handleDocumentMouseDown", () => {
|
|
41167
|
+
});
|
|
41168
|
+
}
|
|
41169
|
+
initCommandBarElement(elem) {
|
|
41170
|
+
addClass(elem, "dialog", "manual");
|
|
41171
|
+
}
|
|
41172
|
+
initItemElement(item, elem) {
|
|
41173
|
+
}
|
|
41174
|
+
show(target, options) {
|
|
41175
|
+
this.manualShow(target, {
|
|
41176
|
+
...options,
|
|
41177
|
+
theme: "light"
|
|
41178
|
+
});
|
|
41179
|
+
}
|
|
41180
|
+
get dialogContent() {
|
|
41181
|
+
const item = this.items[0];
|
|
41182
|
+
assert(logger$2B, item, "no dialog item");
|
|
41183
|
+
const content = item.element;
|
|
41184
|
+
assert(logger$2B, content, "no item element");
|
|
41185
|
+
return content;
|
|
41186
|
+
}
|
|
41187
|
+
static getCommandItems(content, options) {
|
|
41188
|
+
var _a;
|
|
41189
|
+
const id = (_a = options == null ? void 0 : options.id) != null ? _a : `manual-dialog-${genId()}`;
|
|
41190
|
+
const items = [{
|
|
41191
|
+
id,
|
|
41192
|
+
name: "",
|
|
41193
|
+
element: content
|
|
41194
|
+
}];
|
|
41195
|
+
return items;
|
|
41196
|
+
}
|
|
41197
|
+
}
|
|
41198
|
+
const dropdown = "";
|
|
41199
|
+
const mobileBottomMenu$1 = "";
|
|
41200
|
+
function initMenuItem(item, elem) {
|
|
41152
41201
|
var _a, _b;
|
|
41153
41202
|
addClass(elem, "menu-item");
|
|
41154
41203
|
if (item.element) {
|
|
@@ -41974,7 +42023,7 @@ ${codeText}
|
|
|
41974
42023
|
destroy() {
|
|
41975
42024
|
this.colorPaletteItem.destroy();
|
|
41976
42025
|
this.element.removeEventListener("click", this.handleButtonClick);
|
|
41977
|
-
this.element.removeEventListener("
|
|
42026
|
+
this.element.removeEventListener("touchend", this.handleButtonClick);
|
|
41978
42027
|
this.removeAllListeners();
|
|
41979
42028
|
}
|
|
41980
42029
|
updatePaletteColor() {
|
|
@@ -50256,6 +50305,9 @@ ${codeText}
|
|
|
50256
50305
|
this.editor = editor;
|
|
50257
50306
|
}
|
|
50258
50307
|
handleBeforeKeyDown(editor, event) {
|
|
50308
|
+
if (!editor.isWritable()) {
|
|
50309
|
+
return false;
|
|
50310
|
+
}
|
|
50259
50311
|
const selectBlocks = editor.selection.range.getSelectedBlocks();
|
|
50260
50312
|
if (selectBlocks.length === 0) {
|
|
50261
50313
|
return false;
|
|
@@ -52170,7 +52222,10 @@ ${codeText}
|
|
|
52170
52222
|
}
|
|
52171
52223
|
this.toolbar.updateItems(commands);
|
|
52172
52224
|
const lastBlock2 = selectedBlocks[selectedBlocks.length - 1];
|
|
52173
|
-
|
|
52225
|
+
let reverseToolbar = !this.editor.selection.range.isReverse() && lastBlock2 !== firstBlock;
|
|
52226
|
+
if (!reverseToolbar && isTitleBlock$2(firstBlock.block)) {
|
|
52227
|
+
reverseToolbar = true;
|
|
52228
|
+
}
|
|
52174
52229
|
const selectedBlock = reverseToolbar ? lastBlock2 : firstBlock;
|
|
52175
52230
|
const rect = getReferenceClientRect(this.editor, selectedBlock);
|
|
52176
52231
|
const anchor2 = createBlockAnchor(this.editor, selectedBlock.block, "editor-readonly-toolbar", rect);
|
|
@@ -60408,9 +60463,8 @@ $$${mathData.mathjaxText}$$
|
|
|
60408
60463
|
return styles1;
|
|
60409
60464
|
}
|
|
60410
60465
|
function mergeActiveStyle(editor, style2) {
|
|
60411
|
-
var _a;
|
|
60412
60466
|
const attributes = Object.fromEntries(style2.entries());
|
|
60413
|
-
(
|
|
60467
|
+
BlockAttributesHandler.get(editor).setActiveBlockAttributes(attributes);
|
|
60414
60468
|
return new Map(Object.entries(attributes));
|
|
60415
60469
|
}
|
|
60416
60470
|
function applyTextStyle(editor, block, range, style2, value) {
|
|
@@ -60610,7 +60664,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60610
60664
|
this.colorItem.addListener("onClick", this.handleChangeColor);
|
|
60611
60665
|
}
|
|
60612
60666
|
get blockAttributesHandler() {
|
|
60613
|
-
return this.editor
|
|
60667
|
+
return BlockAttributesHandler.get(this.editor);
|
|
60614
60668
|
}
|
|
60615
60669
|
getAvailableCommands(editor, block, range, params) {
|
|
60616
60670
|
const disable = !isTextKindBlock(editor, block) || isSelectBoxOnly(editor) || isSelectedTitleBlock(editor);
|
|
@@ -60767,7 +60821,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60767
60821
|
return commands.map(TextCommandProvider.toTextCommand);
|
|
60768
60822
|
}
|
|
60769
60823
|
executeCommand(editor, block, range, item, params, result) {
|
|
60770
|
-
var _a;
|
|
60824
|
+
var _a, _b;
|
|
60771
60825
|
if (!isTextKindBlock(editor, block)) {
|
|
60772
60826
|
return false;
|
|
60773
60827
|
}
|
|
@@ -60786,7 +60840,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60786
60840
|
const commandId = TextCommandProvider.fromTextCommandId(item.id);
|
|
60787
60841
|
if (commandId.startsWith("style-")) {
|
|
60788
60842
|
if (editor.selection.range.isCollapsed()) {
|
|
60789
|
-
this.blockAttributesHandler.setActiveAttribute(commandId, value);
|
|
60843
|
+
(_a = this.blockAttributesHandler) == null ? void 0 : _a.setActiveAttribute(commandId, value);
|
|
60790
60844
|
return true;
|
|
60791
60845
|
}
|
|
60792
60846
|
if (getBlockTextLength$6(editor, block) === 0) {
|
|
@@ -60794,20 +60848,21 @@ $$${mathData.mathjaxText}$$
|
|
|
60794
60848
|
}
|
|
60795
60849
|
}
|
|
60796
60850
|
for (const provider of this.providers) {
|
|
60797
|
-
if ((
|
|
60851
|
+
if ((_b = provider.executeCommand) == null ? void 0 : _b.call(provider, editor, block, range, { ...item, id: commandId }, params, result)) {
|
|
60798
60852
|
return true;
|
|
60799
60853
|
}
|
|
60800
60854
|
}
|
|
60801
60855
|
return false;
|
|
60802
60856
|
}
|
|
60803
60857
|
get blockAttributesHandler() {
|
|
60804
|
-
return this.editor
|
|
60858
|
+
return BlockAttributesHandler.get(this.editor);
|
|
60805
60859
|
}
|
|
60806
60860
|
executeCommandOnEmptyText(block, item, params) {
|
|
60807
|
-
|
|
60861
|
+
var _a, _b;
|
|
60862
|
+
let attributes = (_a = this.blockAttributesHandler) == null ? void 0 : _a.getEmptyBlockTextAttributes(getBlockId(block));
|
|
60808
60863
|
if (!attributes) {
|
|
60809
60864
|
attributes = {};
|
|
60810
|
-
this.blockAttributesHandler.setEmptyBlockTextAttributes(getBlockId(block), attributes);
|
|
60865
|
+
(_b = this.blockAttributesHandler) == null ? void 0 : _b.setEmptyBlockTextAttributes(getBlockId(block), attributes);
|
|
60811
60866
|
}
|
|
60812
60867
|
const command = TextCommandProvider.fromTextCommandId(item.id);
|
|
60813
60868
|
const value = params.value;
|
|
@@ -60819,9 +60874,9 @@ $$${mathData.mathjaxText}$$
|
|
|
60819
60874
|
return true;
|
|
60820
60875
|
}
|
|
60821
60876
|
setCommandsStates(commands, block) {
|
|
60822
|
-
var _a;
|
|
60877
|
+
var _a, _b;
|
|
60823
60878
|
const blockId = getBlockId(block);
|
|
60824
|
-
const attributes = (_a = this.blockAttributesHandler.getEmptyBlockTextAttributes(blockId)) != null ?
|
|
60879
|
+
const attributes = (_b = (_a = this.blockAttributesHandler) == null ? void 0 : _a.getEmptyBlockTextAttributes(blockId)) != null ? _b : {};
|
|
60825
60880
|
return commands.map((item) => {
|
|
60826
60881
|
var _a2;
|
|
60827
60882
|
const value = attributes[item.id];
|
|
@@ -76746,12 +76801,6 @@ ${content}
|
|
|
76746
76801
|
id: "download",
|
|
76747
76802
|
name: i18n$1.t("file.commands.download"),
|
|
76748
76803
|
icon: DownloadIcon
|
|
76749
|
-
}, {
|
|
76750
|
-
id: "add-comment",
|
|
76751
|
-
name: i18n$1.t("file.commands.comment"),
|
|
76752
|
-
icon: CommentIcon$1,
|
|
76753
|
-
groupOrder: 1e3,
|
|
76754
|
-
order: 100
|
|
76755
76804
|
}, {
|
|
76756
76805
|
id: "sep",
|
|
76757
76806
|
name: "",
|
|
@@ -76780,10 +76829,6 @@ ${content}
|
|
|
76780
76829
|
if (!options.canDownload) {
|
|
76781
76830
|
result = result.filter((command) => command.id !== "download");
|
|
76782
76831
|
}
|
|
76783
|
-
const { enableComments = true } = this.editor.options;
|
|
76784
|
-
if (!enableComments) {
|
|
76785
|
-
result = result.filter((command) => command.id !== "add-comment");
|
|
76786
|
-
}
|
|
76787
76832
|
return result;
|
|
76788
76833
|
}
|
|
76789
76834
|
executeCommand(editor, block, item) {
|
|
@@ -76815,8 +76860,6 @@ ${content}
|
|
|
76815
76860
|
});
|
|
76816
76861
|
} else if (item.id === "download") {
|
|
76817
76862
|
downloadFile(editor, block);
|
|
76818
|
-
} else if (item.id === "add-comment") {
|
|
76819
|
-
addCommentToBlock$1(editor, block);
|
|
76820
76863
|
}
|
|
76821
76864
|
}
|
|
76822
76865
|
}
|
|
@@ -80539,7 +80582,7 @@ ${content}
|
|
|
80539
80582
|
"preset-1": {
|
|
80540
80583
|
name: i18n$1.t("callout.command.presetAlert"),
|
|
80541
80584
|
backgroundColor: 2,
|
|
80542
|
-
icon: WarningFilledIcon
|
|
80585
|
+
icon: WarningFilledIcon.replaceAll('fill="currentColor"', 'fill="#F59300"')
|
|
80543
80586
|
}
|
|
80544
80587
|
};
|
|
80545
80588
|
return presets[id];
|
|
@@ -81140,8 +81183,8 @@ ${content}
|
|
|
81140
81183
|
},
|
|
81141
81184
|
convertTo: convertTo$6
|
|
81142
81185
|
};
|
|
81143
|
-
const HANDLE_CIRCLE_SIZE =
|
|
81144
|
-
const HANDLE_WIDTH =
|
|
81186
|
+
const HANDLE_CIRCLE_SIZE = 7;
|
|
81187
|
+
const HANDLE_WIDTH = 7;
|
|
81145
81188
|
function createSelectHandle(type) {
|
|
81146
81189
|
const container = createElement("div", ["select-handle", type], null);
|
|
81147
81190
|
createElement("div", ["line"], container);
|
|
@@ -81927,6 +81970,906 @@ ${content}
|
|
|
81927
81970
|
this.gripper.destroy();
|
|
81928
81971
|
}
|
|
81929
81972
|
}
|
|
81973
|
+
function getContentTypeFromHeaders(headers) {
|
|
81974
|
+
const entries = Object.entries(headers);
|
|
81975
|
+
for (let i = 0; i < entries.length; i++) {
|
|
81976
|
+
const [key, value] = entries[i];
|
|
81977
|
+
if (key.toLocaleLowerCase() === "content-type") {
|
|
81978
|
+
return value;
|
|
81979
|
+
}
|
|
81980
|
+
}
|
|
81981
|
+
return "";
|
|
81982
|
+
}
|
|
81983
|
+
async function downloadImageToFile(editor, src, withCredentials = true) {
|
|
81984
|
+
try {
|
|
81985
|
+
const res = await editor.doc.request(src, {
|
|
81986
|
+
method: "get",
|
|
81987
|
+
responseType: "blob",
|
|
81988
|
+
withCredentials
|
|
81989
|
+
});
|
|
81990
|
+
const reader = new FileReader();
|
|
81991
|
+
const promise = new Promise((resolve, reject) => {
|
|
81992
|
+
reader.onload = resolve;
|
|
81993
|
+
reader.onerror = reject;
|
|
81994
|
+
});
|
|
81995
|
+
reader.readAsArrayBuffer(res.data);
|
|
81996
|
+
await promise;
|
|
81997
|
+
const buffer = reader.result;
|
|
81998
|
+
const contentType = getContentTypeFromHeaders(res.headers).toLocaleLowerCase();
|
|
81999
|
+
let ext = "";
|
|
82000
|
+
if (contentType) {
|
|
82001
|
+
const extensions = mime__default.default[contentType].extensions;
|
|
82002
|
+
if (extensions && extensions.length > 0) {
|
|
82003
|
+
ext = extensions[0];
|
|
82004
|
+
}
|
|
82005
|
+
}
|
|
82006
|
+
const file2 = new File([buffer], `${Date.now()}.${ext}`, {
|
|
82007
|
+
type: contentType
|
|
82008
|
+
});
|
|
82009
|
+
return file2;
|
|
82010
|
+
} catch (err) {
|
|
82011
|
+
return null;
|
|
82012
|
+
}
|
|
82013
|
+
}
|
|
82014
|
+
async function downloadObjectToFile(editor, url) {
|
|
82015
|
+
const file2 = await downloadImageToFile(editor, url);
|
|
82016
|
+
return file2;
|
|
82017
|
+
}
|
|
82018
|
+
async function downloadSvgToString(editor, url) {
|
|
82019
|
+
const file2 = await downloadObjectToFile(editor, url);
|
|
82020
|
+
if (!file2)
|
|
82021
|
+
return null;
|
|
82022
|
+
const text2 = await file2.text();
|
|
82023
|
+
return text2;
|
|
82024
|
+
}
|
|
82025
|
+
const isEmptyImage = (svg) => {
|
|
82026
|
+
if (svg.naturalWidth <= 1 && svg.naturalHeight <= 1) {
|
|
82027
|
+
return true;
|
|
82028
|
+
}
|
|
82029
|
+
return false;
|
|
82030
|
+
};
|
|
82031
|
+
const isEmptySvg = (svg) => {
|
|
82032
|
+
var _a, _b;
|
|
82033
|
+
const widthStr = (_a = svg.getAttribute("width")) != null ? _a : "";
|
|
82034
|
+
const heightStr = (_b = svg.getAttribute("height")) != null ? _b : "";
|
|
82035
|
+
const width = Number.parseInt(widthStr, 10);
|
|
82036
|
+
const height = Number.parseInt(heightStr, 10);
|
|
82037
|
+
if (!width || !height) {
|
|
82038
|
+
return true;
|
|
82039
|
+
}
|
|
82040
|
+
if (width <= 1 && height <= 1) {
|
|
82041
|
+
return true;
|
|
82042
|
+
}
|
|
82043
|
+
return false;
|
|
82044
|
+
};
|
|
82045
|
+
const getTextContent = (node) => node != null ? node[node.textContent === void 0 ? "text" : "textContent"] : "";
|
|
82046
|
+
function loopCheckResourceWasLoaded(options) {
|
|
82047
|
+
const { checker, maxRetryTime } = options;
|
|
82048
|
+
const startTime = Date.now();
|
|
82049
|
+
return new Promise((resolve, reject) => {
|
|
82050
|
+
function check() {
|
|
82051
|
+
try {
|
|
82052
|
+
if (checker()) {
|
|
82053
|
+
resolve();
|
|
82054
|
+
} else if (Date.now() - startTime > maxRetryTime) {
|
|
82055
|
+
reject(new Error("Max retry time exceeded"));
|
|
82056
|
+
} else {
|
|
82057
|
+
setTimeout(check, 100);
|
|
82058
|
+
}
|
|
82059
|
+
} catch (error2) {
|
|
82060
|
+
reject(error2);
|
|
82061
|
+
}
|
|
82062
|
+
}
|
|
82063
|
+
check();
|
|
82064
|
+
});
|
|
82065
|
+
}
|
|
82066
|
+
const DrawioLang = {
|
|
82067
|
+
"zh-CN": "zh",
|
|
82068
|
+
"zh-TW": "zh-tw",
|
|
82069
|
+
"ja-JP": "ja",
|
|
82070
|
+
"en-US": "en"
|
|
82071
|
+
};
|
|
82072
|
+
const drawioIframeUrl = "https://embed.diagrams.net/?embed=1";
|
|
82073
|
+
const DrawioJsUrl = "https://www.draw.io/embed.js";
|
|
82074
|
+
const PakoJsUrl = "https://cdn.jsdelivr.net/npm/pako@2.0.3/dist/pako.es5.js";
|
|
82075
|
+
const EmptyIcon = '<svg width="48" height="49" viewBox="0 0 48 49" fill="none" xmlns="http://www.w3.org/2000/svg">\n<rect x="27" y="18.5" width="18" height="9" stroke="#C7C7C7" stroke-width="3"/>\n<rect x="12" y="18.5" width="9" height="9" transform="rotate(45 12 18.5)" stroke="#C7C7C7" stroke-width="3"/>\n<rect x="27" y="36.5" width="18" height="9" stroke="#C7C7C7" stroke-width="3"/>\n<path d="M27 24.5L18 24.5" stroke="#C7C7C7" stroke-width="3"/>\n<path d="M28.5 41H18" stroke="#C7C7C7" stroke-width="3"/>\n<path d="M18 41H12L12 30.5" stroke="#C7C7C7" stroke-width="3"/>\n<path d="M12 21.5L12 12.5" stroke="#C7C7C7" stroke-width="3"/>\n<rect x="7.5" y="3.5" width="9" height="9" rx="4.5" stroke="#C7C7C7" stroke-width="3"/>\n</svg>\n';
|
|
82076
|
+
const DEFAULT_STYLES = `
|
|
82077
|
+
<mxStylesheet>
|
|
82078
|
+
<add as="defaultVertex">
|
|
82079
|
+
<add as="shape" value="label"/>
|
|
82080
|
+
<add as="perimeter" value="rectanglePerimeter"/>
|
|
82081
|
+
<add as="fontSize" value="12"/>
|
|
82082
|
+
<add as="fontFamily" value="Helvetica"/>
|
|
82083
|
+
<add as="align" value="center"/>
|
|
82084
|
+
<add as="verticalAlign" value="middle"/>
|
|
82085
|
+
<add as="fillColor" value="#ffffff"/>
|
|
82086
|
+
<add as="strokeColor" value="#000000"/>
|
|
82087
|
+
<add as="fontColor" value="#000000"/>
|
|
82088
|
+
</add>
|
|
82089
|
+
<add as="defaultEdge">
|
|
82090
|
+
<add as="shape" value="connector"/>
|
|
82091
|
+
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
82092
|
+
<add as="endArrow" value="classic"/>
|
|
82093
|
+
<add as="fontSize" value="11"/>
|
|
82094
|
+
<add as="fontFamily" value="Helvetica"/>
|
|
82095
|
+
<add as="align" value="center"/>
|
|
82096
|
+
<add as="verticalAlign" value="middle"/>
|
|
82097
|
+
<add as="rounded" value="1"/>
|
|
82098
|
+
<add as="strokeColor" value="#000000"/>
|
|
82099
|
+
<add as="fontColor" value="#000000"/>
|
|
82100
|
+
</add>
|
|
82101
|
+
<add as="text">
|
|
82102
|
+
<add as="fillColor" value="none"/>
|
|
82103
|
+
<add as="gradientColor" value="none"/>
|
|
82104
|
+
<add as="strokeColor" value="none"/>
|
|
82105
|
+
<add as="align" value="left"/>
|
|
82106
|
+
<add as="verticalAlign" value="top"/>
|
|
82107
|
+
</add>
|
|
82108
|
+
<add as="edgeLabel" extend="text">
|
|
82109
|
+
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
82110
|
+
<add as="fontSize" value="11"/>
|
|
82111
|
+
</add>
|
|
82112
|
+
<add as="label">
|
|
82113
|
+
<add as="fontStyle" value="1"/>
|
|
82114
|
+
<add as="align" value="left"/>
|
|
82115
|
+
<add as="verticalAlign" value="middle"/>
|
|
82116
|
+
<add as="spacing" value="2"/>
|
|
82117
|
+
<add as="spacingLeft" value="52"/>
|
|
82118
|
+
<add as="imageWidth" value="42"/>
|
|
82119
|
+
<add as="imageHeight" value="42"/>
|
|
82120
|
+
<add as="rounded" value="1"/>
|
|
82121
|
+
</add>
|
|
82122
|
+
<add as="icon" extend="label">
|
|
82123
|
+
<add as="align" value="center"/>
|
|
82124
|
+
<add as="imageAlign" value="center"/>
|
|
82125
|
+
<add as="verticalLabelPosition" value="bottom"/>
|
|
82126
|
+
<add as="verticalAlign" value="top"/>
|
|
82127
|
+
<add as="spacingTop" value="4"/>
|
|
82128
|
+
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
82129
|
+
<add as="spacing" value="0"/>
|
|
82130
|
+
<add as="spacingLeft" value="0"/>
|
|
82131
|
+
<add as="spacingTop" value="6"/>
|
|
82132
|
+
<add as="fontStyle" value="0"/>
|
|
82133
|
+
<add as="imageWidth" value="48"/>
|
|
82134
|
+
<add as="imageHeight" value="48"/>
|
|
82135
|
+
</add>
|
|
82136
|
+
<add as="swimlane">
|
|
82137
|
+
<add as="shape" value="swimlane"/>
|
|
82138
|
+
<add as="fontSize" value="12"/>
|
|
82139
|
+
<add as="fontStyle" value="1"/>
|
|
82140
|
+
<add as="startSize" value="23"/>
|
|
82141
|
+
</add>
|
|
82142
|
+
<add as="group">
|
|
82143
|
+
<add as="verticalAlign" value="top"/>
|
|
82144
|
+
<add as="fillColor" value="none"/>
|
|
82145
|
+
<add as="strokeColor" value="none"/>
|
|
82146
|
+
<add as="gradientColor" value="none"/>
|
|
82147
|
+
<add as="pointerEvents" value="0"/>
|
|
82148
|
+
</add>
|
|
82149
|
+
<add as="ellipse">
|
|
82150
|
+
<add as="shape" value="ellipse"/>
|
|
82151
|
+
<add as="perimeter" value="ellipsePerimeter"/>
|
|
82152
|
+
</add>
|
|
82153
|
+
<add as="rhombus">
|
|
82154
|
+
<add as="shape" value="rhombus"/>
|
|
82155
|
+
<add as="perimeter" value="rhombusPerimeter"/>
|
|
82156
|
+
</add>
|
|
82157
|
+
<add as="triangle">
|
|
82158
|
+
<add as="shape" value="triangle"/>
|
|
82159
|
+
<add as="perimeter" value="trianglePerimeter"/>
|
|
82160
|
+
</add>
|
|
82161
|
+
<add as="line">
|
|
82162
|
+
<add as="shape" value="line"/>
|
|
82163
|
+
<add as="strokeWidth" value="4"/>
|
|
82164
|
+
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
82165
|
+
<add as="verticalAlign" value="top"/>
|
|
82166
|
+
<add as="spacingTop" value="8"/>
|
|
82167
|
+
</add>
|
|
82168
|
+
<add as="image">
|
|
82169
|
+
<add as="shape" value="image"/>
|
|
82170
|
+
<add as="labelBackgroundColor" value="white"/>
|
|
82171
|
+
<add as="verticalAlign" value="top"/>
|
|
82172
|
+
<add as="verticalLabelPosition" value="bottom"/>
|
|
82173
|
+
</add>
|
|
82174
|
+
<add as="roundImage" extend="image">
|
|
82175
|
+
<add as="perimeter" value="ellipsePerimeter"/>
|
|
82176
|
+
</add>
|
|
82177
|
+
<add as="rhombusImage" extend="image">
|
|
82178
|
+
<add as="perimeter" value="rhombusPerimeter"/>
|
|
82179
|
+
</add>
|
|
82180
|
+
<add as="arrow">
|
|
82181
|
+
<add as="shape" value="arrow"/>
|
|
82182
|
+
<add as="edgeStyle" value="none"/>
|
|
82183
|
+
<add as="fillColor" value="#ffffff"/>
|
|
82184
|
+
</add>
|
|
82185
|
+
</mxStylesheet>
|
|
82186
|
+
`;
|
|
82187
|
+
const toast = "";
|
|
82188
|
+
const showWarnToast = () => {
|
|
82189
|
+
const errorHTML = `<span class="toast-message">${WarningFilledIcon}${i18n$1.t("drawio.warnTips")}</span>`;
|
|
82190
|
+
const hide = showToast(errorHTML, {
|
|
82191
|
+
autoClose: true,
|
|
82192
|
+
position: {
|
|
82193
|
+
y: 30,
|
|
82194
|
+
x: window.innerWidth / 2
|
|
82195
|
+
},
|
|
82196
|
+
html: true,
|
|
82197
|
+
theme: "warn"
|
|
82198
|
+
});
|
|
82199
|
+
return hide;
|
|
82200
|
+
};
|
|
82201
|
+
const BORDER = 0;
|
|
82202
|
+
const SAVE_DELAY_TIME = 30 * 1e3;
|
|
82203
|
+
const DRAWIO_EMPTY_CLASS = "editor-empty-drawio";
|
|
82204
|
+
const SHOW_FULL_SCREEN_IFRAME = "show-full-screen-iframe";
|
|
82205
|
+
const logger$j = getLogger("embed-block-drawio");
|
|
82206
|
+
function getDrawioOptions(editor) {
|
|
82207
|
+
const compOptions = editor.options.componentsOptions;
|
|
82208
|
+
return compOptions.drawIO || {};
|
|
82209
|
+
}
|
|
82210
|
+
function getDrawioLang(editor) {
|
|
82211
|
+
const options = getDrawioOptions(editor);
|
|
82212
|
+
const lang = options.lang;
|
|
82213
|
+
return lang ? DrawioLang[lang] : "";
|
|
82214
|
+
}
|
|
82215
|
+
function getDrawioIframeUrl(editor) {
|
|
82216
|
+
var _a;
|
|
82217
|
+
const options = getDrawioOptions(editor) || {};
|
|
82218
|
+
const iframeUrl = ((_a = options.cdn) == null ? void 0 : _a.drawioIframe) || drawioIframeUrl;
|
|
82219
|
+
const lang = getDrawioLang(editor);
|
|
82220
|
+
return updateUrl(iframeUrl, {
|
|
82221
|
+
spin: 1,
|
|
82222
|
+
proto: "json",
|
|
82223
|
+
configure: 1,
|
|
82224
|
+
lang
|
|
82225
|
+
});
|
|
82226
|
+
}
|
|
82227
|
+
function resizeObserver(el) {
|
|
82228
|
+
const resize = () => {
|
|
82229
|
+
assert(logger$j, el, "el does not exist");
|
|
82230
|
+
const width = document.body.clientWidth || document.documentElement.clientWidth;
|
|
82231
|
+
const height = document.body.clientHeight || document.documentElement.clientHeight;
|
|
82232
|
+
el.setAttribute("width", `${width - 2 * BORDER}`);
|
|
82233
|
+
el.setAttribute("height", `${height - 2 * BORDER}`);
|
|
82234
|
+
};
|
|
82235
|
+
const disconnect = () => {
|
|
82236
|
+
window.removeEventListener("resize", resize);
|
|
82237
|
+
};
|
|
82238
|
+
resize();
|
|
82239
|
+
window.addEventListener("resize", resize);
|
|
82240
|
+
return {
|
|
82241
|
+
disconnect
|
|
82242
|
+
};
|
|
82243
|
+
}
|
|
82244
|
+
async function initializeDrawioIframe(editor, block) {
|
|
82245
|
+
const options = getDrawioOptions(editor) || {};
|
|
82246
|
+
const callbacks = options.callbacks || {};
|
|
82247
|
+
const docReAuthCallbacks = editor.getCustom(DOC_RE_AUTH_KEYS);
|
|
82248
|
+
const { onCreateDrawIoFrame, onCloseDrawIoFrame } = callbacks;
|
|
82249
|
+
let drawioIframe = null;
|
|
82250
|
+
let exit;
|
|
82251
|
+
if (onCreateDrawIoFrame) {
|
|
82252
|
+
drawioIframe = await onCreateDrawIoFrame(editor);
|
|
82253
|
+
assert(logger$j, drawioIframe, "iframe create failed");
|
|
82254
|
+
exit = () => {
|
|
82255
|
+
assert(logger$j, drawioIframe, "iframe does not exist");
|
|
82256
|
+
assert(logger$j, onCloseDrawIoFrame, "missing parameters: onCloseDrawIoFrame");
|
|
82257
|
+
docReAuthCallbacks.removeListeners();
|
|
82258
|
+
onCloseDrawIoFrame(editor, drawioIframe);
|
|
82259
|
+
};
|
|
82260
|
+
} else {
|
|
82261
|
+
const drawioContainer = createElement("div", ["editor-drawio-iframe-container", "loading"], document.body);
|
|
82262
|
+
drawioContainer.setAttribute("data-placeholder", i18n$1.t("drawio.loading"));
|
|
82263
|
+
drawioIframe = createElement("iframe", ["drawio-iframe-element"], drawioContainer);
|
|
82264
|
+
drawioIframe.setAttribute("frameborder", "0");
|
|
82265
|
+
addClass(drawioContainer, SHOW_FULL_SCREEN_IFRAME);
|
|
82266
|
+
const { disconnect } = resizeObserver(drawioIframe);
|
|
82267
|
+
exit = () => {
|
|
82268
|
+
assert(logger$j, drawioIframe, "iframe does not exist");
|
|
82269
|
+
docReAuthCallbacks.removeListeners();
|
|
82270
|
+
disconnect();
|
|
82271
|
+
document.body.removeChild(drawioContainer);
|
|
82272
|
+
removeClass(drawioContainer, SHOW_FULL_SCREEN_IFRAME);
|
|
82273
|
+
};
|
|
82274
|
+
}
|
|
82275
|
+
docReAuthCallbacks.addAuthListen("authError", () => {
|
|
82276
|
+
logger$j.debug("authError! render error toolbar");
|
|
82277
|
+
docReAuthCallbacks.reAuthToolbar.render(block, exit);
|
|
82278
|
+
});
|
|
82279
|
+
return {
|
|
82280
|
+
drawioIframe,
|
|
82281
|
+
exit
|
|
82282
|
+
};
|
|
82283
|
+
}
|
|
82284
|
+
async function saveSvgToBlock(editor, block, svg, autoSave) {
|
|
82285
|
+
var _a, _b;
|
|
82286
|
+
try {
|
|
82287
|
+
if (autoSave) {
|
|
82288
|
+
logger$j.debug("auto saving drawio data");
|
|
82289
|
+
}
|
|
82290
|
+
const regex = /(<svg [^<>]* )modified="[^&]*"([^<>]* )etag="[^&]*"/gm;
|
|
82291
|
+
const subst = "$1$2";
|
|
82292
|
+
const normalizedSvg = svg.replace(regex, subst);
|
|
82293
|
+
const blob = new Blob([normalizedSvg]);
|
|
82294
|
+
const file2 = new File([blob], "drawio.svg", {
|
|
82295
|
+
type: "image/svg+xml"
|
|
82296
|
+
});
|
|
82297
|
+
const targetBlock = editor.findBlockById(getBlockId(block));
|
|
82298
|
+
if (targetBlock) {
|
|
82299
|
+
const res = await editor.doc.uploadResource(file2);
|
|
82300
|
+
const { resourceId } = res;
|
|
82301
|
+
const oldData = editor.getBlockData(targetBlock);
|
|
82302
|
+
const oldEmbedData = oldData.embedData;
|
|
82303
|
+
const newEmbedData = {
|
|
82304
|
+
src: resourceId,
|
|
82305
|
+
height: oldEmbedData == null ? void 0 : oldEmbedData.height
|
|
82306
|
+
};
|
|
82307
|
+
editor.updateEmbedData(targetBlock, newEmbedData);
|
|
82308
|
+
} else {
|
|
82309
|
+
logger$j.error("block has been deleted");
|
|
82310
|
+
}
|
|
82311
|
+
} catch (err) {
|
|
82312
|
+
const message = `failed to save drawio data: ${err.message}`;
|
|
82313
|
+
const options = getDrawioOptions(editor);
|
|
82314
|
+
if ((_a = options.callbacks) == null ? void 0 : _a.onError) {
|
|
82315
|
+
const newError = new Error(message);
|
|
82316
|
+
newError.code = "SaveDrawIo";
|
|
82317
|
+
(_b = options.callbacks) == null ? void 0 : _b.onError(editor, newError);
|
|
82318
|
+
}
|
|
82319
|
+
throw err;
|
|
82320
|
+
}
|
|
82321
|
+
}
|
|
82322
|
+
class LoadingHandler {
|
|
82323
|
+
constructor() {
|
|
82324
|
+
__publicField(this, "loadingContainer");
|
|
82325
|
+
__publicField(this, "setLoading", (iframe, placeholder2 = i18n$1.t("drawio.save")) => {
|
|
82326
|
+
const parent = iframe.parentElement;
|
|
82327
|
+
if (parent) {
|
|
82328
|
+
addClass(parent, "loading");
|
|
82329
|
+
parent.setAttribute("data-placeholder", placeholder2);
|
|
82330
|
+
}
|
|
82331
|
+
});
|
|
82332
|
+
__publicField(this, "removeLoading", () => {
|
|
82333
|
+
const containers = document.querySelectorAll(".editor-drawio-iframe-container");
|
|
82334
|
+
containers.forEach((r) => {
|
|
82335
|
+
removeClass(r, "loading");
|
|
82336
|
+
});
|
|
82337
|
+
});
|
|
82338
|
+
}
|
|
82339
|
+
}
|
|
82340
|
+
function contactWithIframe(editor, block, drawIoData, iframe, loaded, exit, isInitializationCompleted2) {
|
|
82341
|
+
const destroy = () => {
|
|
82342
|
+
window.removeEventListener("message", receive);
|
|
82343
|
+
exit();
|
|
82344
|
+
};
|
|
82345
|
+
const loadingHandler = new LoadingHandler();
|
|
82346
|
+
loadingHandler.setLoading(iframe, i18n$1.t("drawio.loading"));
|
|
82347
|
+
let exportFlag = "auto";
|
|
82348
|
+
const receive = async (evt) => {
|
|
82349
|
+
var _a, _b;
|
|
82350
|
+
assert(logger$j, iframe.contentWindow, "iframe.contentWindow does not exist");
|
|
82351
|
+
if (evt.data.length > 0) {
|
|
82352
|
+
const msg = JSON.parse(evt.data);
|
|
82353
|
+
const xml = drawIoData.xmlSvg || drawIoData.xml;
|
|
82354
|
+
assert(logger$j, xml, "xml does not exist");
|
|
82355
|
+
switch (msg.event) {
|
|
82356
|
+
case "configure":
|
|
82357
|
+
iframe.contentWindow.postMessage(JSON.stringify({
|
|
82358
|
+
action: "configure",
|
|
82359
|
+
config: {
|
|
82360
|
+
defaultFonts: ["Humor Sans", "Helvetica", "Times New Roman"]
|
|
82361
|
+
}
|
|
82362
|
+
}), "*");
|
|
82363
|
+
break;
|
|
82364
|
+
case "init":
|
|
82365
|
+
iframe.contentWindow.postMessage(JSON.stringify({
|
|
82366
|
+
action: "load",
|
|
82367
|
+
saveAndExit: 1,
|
|
82368
|
+
noSaveBtn: 1,
|
|
82369
|
+
noExitBtn: 0,
|
|
82370
|
+
xml
|
|
82371
|
+
}), "*");
|
|
82372
|
+
loaded();
|
|
82373
|
+
loadingHandler.removeLoading();
|
|
82374
|
+
break;
|
|
82375
|
+
case "save":
|
|
82376
|
+
exportFlag = "save";
|
|
82377
|
+
iframe.contentWindow.postMessage(JSON.stringify({
|
|
82378
|
+
action: "export",
|
|
82379
|
+
format: "xmlsvg",
|
|
82380
|
+
spin: "Saving graph"
|
|
82381
|
+
}), "*");
|
|
82382
|
+
break;
|
|
82383
|
+
case "export":
|
|
82384
|
+
if (exportFlag !== "auto") {
|
|
82385
|
+
loadingHandler.setLoading(iframe);
|
|
82386
|
+
}
|
|
82387
|
+
const svg = fromBase64(msg.data.substring(msg.data.indexOf(",") + 1));
|
|
82388
|
+
try {
|
|
82389
|
+
await saveSvgToBlock(editor, block, svg, !!((_a = msg.message) == null ? void 0 : _a.autoSave));
|
|
82390
|
+
if (!((_b = msg.message) == null ? void 0 : _b.autoSave)) {
|
|
82391
|
+
destroy();
|
|
82392
|
+
}
|
|
82393
|
+
} catch (error2) {
|
|
82394
|
+
const docReAuthCallbacks = editor.getCustom(DOC_RE_AUTH_KEYS);
|
|
82395
|
+
docReAuthCallbacks.emit("tokenExpired");
|
|
82396
|
+
if (exportFlag === "save") {
|
|
82397
|
+
docReAuthCallbacks.reAuthToolbar.render(block, exit);
|
|
82398
|
+
}
|
|
82399
|
+
}
|
|
82400
|
+
loadingHandler.removeLoading();
|
|
82401
|
+
exportFlag = "auto";
|
|
82402
|
+
break;
|
|
82403
|
+
case "exit":
|
|
82404
|
+
exportFlag = "exit";
|
|
82405
|
+
destroy();
|
|
82406
|
+
break;
|
|
82407
|
+
}
|
|
82408
|
+
}
|
|
82409
|
+
};
|
|
82410
|
+
window.addEventListener("message", receive);
|
|
82411
|
+
}
|
|
82412
|
+
async function editGraph(editor, block, data2, isInitializationCompleted2) {
|
|
82413
|
+
if (isInitializationCompleted2) {
|
|
82414
|
+
return;
|
|
82415
|
+
}
|
|
82416
|
+
isInitializationCompleted2 = true;
|
|
82417
|
+
const options = getDrawioOptions(editor) || {};
|
|
82418
|
+
const { callbacks } = options;
|
|
82419
|
+
let autoSaveInterval;
|
|
82420
|
+
if (callbacks && (callbacks == null ? void 0 : callbacks.onBeginInitDrawIo)) {
|
|
82421
|
+
callbacks.onBeginInitDrawIo(editor, block);
|
|
82422
|
+
}
|
|
82423
|
+
if (data2.src) {
|
|
82424
|
+
const svg = await downloadSvgToString(editor, editor.doc.buildResourceUrl(data2.src));
|
|
82425
|
+
if (svg) {
|
|
82426
|
+
data2.xmlSvg = svg;
|
|
82427
|
+
}
|
|
82428
|
+
}
|
|
82429
|
+
if (!data2.xml && !data2.xmlSvg) {
|
|
82430
|
+
showWarnToast();
|
|
82431
|
+
return;
|
|
82432
|
+
}
|
|
82433
|
+
const { drawioIframe, exit: exitIframe } = await initializeDrawioIframe(editor, block);
|
|
82434
|
+
exclusiveBlock(editor, block);
|
|
82435
|
+
const loaded = () => {
|
|
82436
|
+
autoSaveInterval = setInterval(() => {
|
|
82437
|
+
if (!drawioIframe || !drawioIframe.contentWindow) {
|
|
82438
|
+
return;
|
|
82439
|
+
}
|
|
82440
|
+
drawioIframe.contentWindow.postMessage(JSON.stringify({
|
|
82441
|
+
action: "export",
|
|
82442
|
+
format: "xmlsvg",
|
|
82443
|
+
spin: "Saving graph",
|
|
82444
|
+
autoSave: true
|
|
82445
|
+
}), "*");
|
|
82446
|
+
}, SAVE_DELAY_TIME);
|
|
82447
|
+
};
|
|
82448
|
+
const exit = () => {
|
|
82449
|
+
exitIframe();
|
|
82450
|
+
if (autoSaveInterval) {
|
|
82451
|
+
clearInterval(autoSaveInterval);
|
|
82452
|
+
}
|
|
82453
|
+
const newBlock = editor.findBlockById(getBlockId(block));
|
|
82454
|
+
if (newBlock) {
|
|
82455
|
+
unexclusiveBlock(editor, newBlock);
|
|
82456
|
+
}
|
|
82457
|
+
};
|
|
82458
|
+
contactWithIframe(editor, block, data2, drawioIframe, loaded, exit);
|
|
82459
|
+
const iframeUrl = getDrawioIframeUrl(editor);
|
|
82460
|
+
drawioIframe.setAttribute("src", iframeUrl);
|
|
82461
|
+
}
|
|
82462
|
+
async function initDrawIo(editor) {
|
|
82463
|
+
var _a, _b;
|
|
82464
|
+
const option = getDrawioOptions(editor);
|
|
82465
|
+
const drawIoUrl = ((_a = option.cdn) == null ? void 0 : _a.drawio) || DrawioJsUrl;
|
|
82466
|
+
const pakoUrl = ((_b = option.cdn) == null ? void 0 : _b.pako) || PakoJsUrl;
|
|
82467
|
+
await loadJsPromise(pakoUrl, "editor-pako");
|
|
82468
|
+
await loadJsPromise(drawIoUrl, "editor-drawio");
|
|
82469
|
+
}
|
|
82470
|
+
function removeDrawioEmptyStatus(embed) {
|
|
82471
|
+
removeClass(embed, DRAWIO_EMPTY_CLASS);
|
|
82472
|
+
}
|
|
82473
|
+
function addDrawioEmptyStatus(embed) {
|
|
82474
|
+
addClass(embed, DRAWIO_EMPTY_CLASS);
|
|
82475
|
+
const emptyContent = createElement("div", ["drawio-empty-content"], embed);
|
|
82476
|
+
emptyContent.innerHTML = EmptyIcon;
|
|
82477
|
+
createElement("span", ["drawio-empty-title"], emptyContent, i18n$1.t("drawio.empty"));
|
|
82478
|
+
}
|
|
82479
|
+
function addDrawioLoadErrorStatus(editor, embed, data2) {
|
|
82480
|
+
const block = getParentBlock(embed);
|
|
82481
|
+
if (!block) {
|
|
82482
|
+
return;
|
|
82483
|
+
}
|
|
82484
|
+
const blockContent = getBlockContent(block);
|
|
82485
|
+
embed.innerHTML = "";
|
|
82486
|
+
embed.style.height = "100%";
|
|
82487
|
+
addClass(block, "drawio-load-error");
|
|
82488
|
+
const errorContent = createElement("div", ["drawio-error-content"], embed);
|
|
82489
|
+
const brandIcon = createElement("div", ["drawio-error-brand-icon"], errorContent);
|
|
82490
|
+
brandIcon.innerHTML = UmlBrandIcon;
|
|
82491
|
+
createElement("div", ["drawio-error-title"], errorContent, i18n$1.t("drawio.errorTips"));
|
|
82492
|
+
const subTitle = createElement("div", ["drawio-error-sub-title"], errorContent);
|
|
82493
|
+
createElement("span", [], subTitle, i18n$1.t("drawio.errorSubTips"));
|
|
82494
|
+
const retryButton = createElement("span", ["drawio-error-retry-button"], subTitle, i18n$1.t("drawio.retry"));
|
|
82495
|
+
retryButton.onclick = () => {
|
|
82496
|
+
embed.innerHTML = "";
|
|
82497
|
+
removeClass(block, "drawio-load-error");
|
|
82498
|
+
if (data2.src) {
|
|
82499
|
+
updateGraphBySrc(data2.src, embed, editor);
|
|
82500
|
+
} else if (data2.xml) {
|
|
82501
|
+
updateGraphByXml(data2.xml, embed, editor);
|
|
82502
|
+
} else if (data2.xmlSvg) {
|
|
82503
|
+
updateGraphByXmlSvg(data2.xmlSvg, embed);
|
|
82504
|
+
}
|
|
82505
|
+
if (data2.height) {
|
|
82506
|
+
blockContent.style.height = `${data2.height}px`;
|
|
82507
|
+
embed.style.height = `${data2.height - 20}px`;
|
|
82508
|
+
}
|
|
82509
|
+
};
|
|
82510
|
+
}
|
|
82511
|
+
function setGraph(embed, data2) {
|
|
82512
|
+
assert(logger$j, data2, "Required data is missing in setGraph");
|
|
82513
|
+
if ("src" in data2) {
|
|
82514
|
+
embed.setAttribute("data-src", data2.src);
|
|
82515
|
+
return;
|
|
82516
|
+
}
|
|
82517
|
+
if ("xmlSvg" in data2) {
|
|
82518
|
+
embed.setAttribute("data-xmlsvg", data2.xmlSvg);
|
|
82519
|
+
return;
|
|
82520
|
+
}
|
|
82521
|
+
if ("graph" in data2) {
|
|
82522
|
+
const { xml, graph: graph2 } = data2;
|
|
82523
|
+
embed.graph = graph2;
|
|
82524
|
+
embed.setAttribute("data-mxfile", xml);
|
|
82525
|
+
}
|
|
82526
|
+
}
|
|
82527
|
+
function getPreGraphData(embed) {
|
|
82528
|
+
return {
|
|
82529
|
+
src: embed.getAttribute("data-src") || "",
|
|
82530
|
+
xmlSvg: embed.getAttribute("data-xmlsvg") || "",
|
|
82531
|
+
xml: embed.getAttribute("data-mxfile") || ""
|
|
82532
|
+
};
|
|
82533
|
+
}
|
|
82534
|
+
function updateGraphBySrc(src, embed, editor) {
|
|
82535
|
+
assert(logger$j, src, "params error: src");
|
|
82536
|
+
assert(logger$j, editor, "params error: editor");
|
|
82537
|
+
const embedEl = embed;
|
|
82538
|
+
const url = editor.doc.buildResourceUrl(src, {
|
|
82539
|
+
syncNewResources: async (resourceId, resourceUrl) => {
|
|
82540
|
+
var _a, _b;
|
|
82541
|
+
await editor.doc.addResources([resourceId]);
|
|
82542
|
+
const serviceAppId = (_b = (_a = editor.doc).getServerMeta) == null ? void 0 : _b.call(_a).appId;
|
|
82543
|
+
if (resourceUrl !== src && serviceAppId && src.includes(serviceAppId)) {
|
|
82544
|
+
const block = getParentBlock(embed);
|
|
82545
|
+
if (block && !editor.readonly && editor.isBlockWritable(block)) {
|
|
82546
|
+
const newBlockData = cloneDeep__default.default(editor.getBlockData(block));
|
|
82547
|
+
newBlockData.embedData.src = resourceId;
|
|
82548
|
+
editor.updateBlockData(block, newBlockData);
|
|
82549
|
+
}
|
|
82550
|
+
}
|
|
82551
|
+
}
|
|
82552
|
+
});
|
|
82553
|
+
const img = document.createElement("img");
|
|
82554
|
+
embedEl.innerHTML = "";
|
|
82555
|
+
embedEl.appendChild(img);
|
|
82556
|
+
img.src = url;
|
|
82557
|
+
img.draggable = false;
|
|
82558
|
+
setGraph(embedEl, { src });
|
|
82559
|
+
img.onload = (e2) => {
|
|
82560
|
+
const img2 = embedEl.querySelector("img");
|
|
82561
|
+
if (e2.target !== img2 || !img2) {
|
|
82562
|
+
return;
|
|
82563
|
+
}
|
|
82564
|
+
if (isEmptyImage(img2)) {
|
|
82565
|
+
addDrawioEmptyStatus(embed);
|
|
82566
|
+
} else {
|
|
82567
|
+
removeDrawioEmptyStatus(embed);
|
|
82568
|
+
}
|
|
82569
|
+
};
|
|
82570
|
+
img.onerror = (e2) => {
|
|
82571
|
+
const img2 = embedEl.querySelector("img");
|
|
82572
|
+
if (e2.target !== img2) {
|
|
82573
|
+
return;
|
|
82574
|
+
}
|
|
82575
|
+
addDrawioLoadErrorStatus(editor, embed, {
|
|
82576
|
+
src
|
|
82577
|
+
});
|
|
82578
|
+
};
|
|
82579
|
+
}
|
|
82580
|
+
function updateGraphByXml(mxFile, embed, editor) {
|
|
82581
|
+
assert(logger$j, editor, "parameter missing");
|
|
82582
|
+
initDrawIo(editor).then(() => loopCheckResourceWasLoaded({
|
|
82583
|
+
checker: () => !!(window.mxUtils && window.mxGraph && window.mxCodec),
|
|
82584
|
+
maxRetryTime: 5e3
|
|
82585
|
+
})).then(() => {
|
|
82586
|
+
const { mxUtils, mxGraph: MxGraph, mxCodec: MxCodec } = window;
|
|
82587
|
+
assert(logger$j, mxUtils, "External resource loading exception: mxUtils");
|
|
82588
|
+
assert(logger$j, MxGraph, "External resource loading exception: MxGraph");
|
|
82589
|
+
assert(logger$j, MxCodec, "External resource loading exception: MxCodec");
|
|
82590
|
+
const file2 = mxUtils.parseXml(mxFile);
|
|
82591
|
+
embed.innerHTML = "";
|
|
82592
|
+
const node = file2.documentElement;
|
|
82593
|
+
assert(logger$j, node, "Resource parsing exception");
|
|
82594
|
+
assert(logger$j, node.nodeName === "mxfile", "Resource parsing exception");
|
|
82595
|
+
const diagrams = node.getElementsByTagName("diagram");
|
|
82596
|
+
assert(logger$j, diagrams.length > 0, "Resource parsing exception");
|
|
82597
|
+
let xmlDoc;
|
|
82598
|
+
const data2 = diagrams[0];
|
|
82599
|
+
if (data2.text || data2.textContent.trim()) {
|
|
82600
|
+
const diagramBase64 = getTextContent(data2);
|
|
82601
|
+
const raw = atob(diagramBase64);
|
|
82602
|
+
const pako = window.pako;
|
|
82603
|
+
assert(logger$j, pako, "External resource loading exception: pako");
|
|
82604
|
+
const encodedXml = pako.inflateRaw(Uint8Array.from(raw, (c) => c.charCodeAt(0)), { to: "string" });
|
|
82605
|
+
const xml = decodeURIComponent(encodedXml);
|
|
82606
|
+
xmlDoc = mxUtils.parseXml(xml);
|
|
82607
|
+
} else {
|
|
82608
|
+
const xml = new XMLSerializer().serializeToString(data2.firstElementChild);
|
|
82609
|
+
xmlDoc = mxUtils.parseXml(xml);
|
|
82610
|
+
}
|
|
82611
|
+
const graph2 = new MxGraph(embed);
|
|
82612
|
+
graph2.resetViewOnRootChange = false;
|
|
82613
|
+
graph2.foldingEnabled = false;
|
|
82614
|
+
graph2.setTooltips(false);
|
|
82615
|
+
graph2.setEnabled(false);
|
|
82616
|
+
graph2.setHtmlLabels(true);
|
|
82617
|
+
const styleDoc = mxUtils.parseXml(DEFAULT_STYLES);
|
|
82618
|
+
const dec = new MxCodec(styleDoc);
|
|
82619
|
+
dec.decode(styleDoc.documentElement, graph2.getStylesheet());
|
|
82620
|
+
const codec = new MxCodec(xmlDoc);
|
|
82621
|
+
codec.decode(codec.document.documentElement, graph2.getModel());
|
|
82622
|
+
graph2.maxFitScale = 1;
|
|
82623
|
+
graph2.fit();
|
|
82624
|
+
graph2.center(true, false);
|
|
82625
|
+
setGraph(embed, { graph: graph2, xml: mxFile });
|
|
82626
|
+
}).catch((err) => {
|
|
82627
|
+
logger$j.error("Failed to Init DrawIo", err);
|
|
82628
|
+
});
|
|
82629
|
+
}
|
|
82630
|
+
function updateGraphByXmlSvg(xmlSvg, embed) {
|
|
82631
|
+
embed.innerHTML = xmlSvg;
|
|
82632
|
+
setGraph(embed, { xmlSvg });
|
|
82633
|
+
const svgElements = embed.querySelectorAll("svg");
|
|
82634
|
+
for (let i = 0; i < svgElements.length; i++) {
|
|
82635
|
+
const svg = svgElements[i];
|
|
82636
|
+
if (!isEmptySvg(svg)) {
|
|
82637
|
+
return;
|
|
82638
|
+
}
|
|
82639
|
+
}
|
|
82640
|
+
addDrawioEmptyStatus(embed);
|
|
82641
|
+
}
|
|
82642
|
+
function getBlockProperties$5(editor, block) {
|
|
82643
|
+
const properties = getStandardEmbedBlockProperties(editor, block, {
|
|
82644
|
+
handleExecuteCommand: (editor2, block2, item) => {
|
|
82645
|
+
if (item.id === "edit") {
|
|
82646
|
+
const data2 = editor2.getBlockData(block2).embedData;
|
|
82647
|
+
editGraph(editor2, block2, data2, false);
|
|
82648
|
+
return true;
|
|
82649
|
+
}
|
|
82650
|
+
if (item.id === "download") {
|
|
82651
|
+
const image = block2.querySelector(".editor-drawio-content img");
|
|
82652
|
+
if (!(image instanceof HTMLImageElement))
|
|
82653
|
+
return true;
|
|
82654
|
+
downloadImageAsPng(image.src);
|
|
82655
|
+
return true;
|
|
82656
|
+
}
|
|
82657
|
+
return false;
|
|
82658
|
+
},
|
|
82659
|
+
extCommands: (editor2, block2) => {
|
|
82660
|
+
const blockContent = getBlockContent(block2);
|
|
82661
|
+
const drawioImg = blockContent.querySelector(".editor-drawio-content img");
|
|
82662
|
+
return [{
|
|
82663
|
+
id: "download",
|
|
82664
|
+
name: i18n$1.t("common.downloadAsImage"),
|
|
82665
|
+
icon: DownloadIcon$1,
|
|
82666
|
+
states: !drawioImg ? ["disabled"] : []
|
|
82667
|
+
}];
|
|
82668
|
+
},
|
|
82669
|
+
presetIds: ["edit"],
|
|
82670
|
+
extIds: ["separator"]
|
|
82671
|
+
});
|
|
82672
|
+
return { ...properties, abstract: i18n$1.t("drawio.abstract") };
|
|
82673
|
+
}
|
|
82674
|
+
const enUS$6 = {
|
|
82675
|
+
drawio: {
|
|
82676
|
+
title: "Flowchart/UML",
|
|
82677
|
+
empty: "Empty graph",
|
|
82678
|
+
loading: "Loading",
|
|
82679
|
+
abstract: "Flowchart/UML",
|
|
82680
|
+
errorTips: "Flowchart/UML loading failed",
|
|
82681
|
+
errorSubTips: "The network service is abnormal, you can",
|
|
82682
|
+
warnTips: "Failed to retrieve flowchart/UML resources, unable to edit.",
|
|
82683
|
+
retry: "Try again",
|
|
82684
|
+
save: "Saving"
|
|
82685
|
+
}
|
|
82686
|
+
};
|
|
82687
|
+
const zhCN$6 = {
|
|
82688
|
+
drawio: {
|
|
82689
|
+
title: "\u6D41\u7A0B\u56FE/UML",
|
|
82690
|
+
empty: "\u7A7A\u56FE\u8868",
|
|
82691
|
+
loading: "\u52A0\u8F7D\u4E2D",
|
|
82692
|
+
abstract: "\u6D41\u7A0B\u56FE/UML",
|
|
82693
|
+
errorTips: "\u6D41\u7A0B\u56FE/UML\u52A0\u8F7D\u5931\u8D25",
|
|
82694
|
+
errorSubTips: "\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5",
|
|
82695
|
+
warnTips: "\u6D41\u7A0B\u56FE/UML \u8D44\u6E90\u83B7\u53D6\u5931\u8D25\uFF0C\u65E0\u6CD5\u8FDB\u884C\u7F16\u8F91\u3002",
|
|
82696
|
+
retry: "\u91CD\u8BD5",
|
|
82697
|
+
save: "\u4FDD\u5B58\u4E2D"
|
|
82698
|
+
}
|
|
82699
|
+
};
|
|
82700
|
+
const jaJP$6 = {
|
|
82701
|
+
drawio: {
|
|
82702
|
+
title: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",
|
|
82703
|
+
empty: "\u30B0\u30E9\u30D5\u30C7\u30FC\u30BF\u306A\u3057",
|
|
82704
|
+
loading: "\u8AAD\u8FBC\u4E2D",
|
|
82705
|
+
abstract: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",
|
|
82706
|
+
errorTips: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML \u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
82707
|
+
errorSubTips: "\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 ",
|
|
82708
|
+
warnTips: "\u7DE8\u96C6\u3067\u304D\u307E\u305B\u3093\u3002\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML \u306E\u30EA\u30BD\u30FC\u30B9\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002",
|
|
82709
|
+
retry: "\u518D\u8A66\u884C",
|
|
82710
|
+
save: "\u4FDD\u5B58\u4E2D"
|
|
82711
|
+
}
|
|
82712
|
+
};
|
|
82713
|
+
const langs = {
|
|
82714
|
+
"en-US": enUS$6,
|
|
82715
|
+
"zh-CN": zhCN$6,
|
|
82716
|
+
"ja-JP": jaJP$6
|
|
82717
|
+
};
|
|
82718
|
+
i18n$1.mergeLang(langs);
|
|
82719
|
+
const logger$i = getLogger("embed-block-drawio");
|
|
82720
|
+
const isInitializationCompleted = false;
|
|
82721
|
+
function editDrawIO(editor, block, embed, data2) {
|
|
82722
|
+
assert(logger$i, embed, `parameter missing: ${embed}`);
|
|
82723
|
+
assert(logger$i, editor, `parameter missing: ${editor}`);
|
|
82724
|
+
editGraph(editor, block, data2, isInitializationCompleted);
|
|
82725
|
+
}
|
|
82726
|
+
function updateViewLayer(editor, embed, data2) {
|
|
82727
|
+
const { src, xml, xmlSvg } = data2;
|
|
82728
|
+
if (src) {
|
|
82729
|
+
updateGraphBySrc(src, embed, editor);
|
|
82730
|
+
} else if (xml) {
|
|
82731
|
+
updateGraphByXml(xml, embed, editor);
|
|
82732
|
+
} else if (xmlSvg) {
|
|
82733
|
+
updateGraphByXmlSvg(xmlSvg, embed);
|
|
82734
|
+
} else {
|
|
82735
|
+
addDrawioEmptyStatus(embed);
|
|
82736
|
+
}
|
|
82737
|
+
}
|
|
82738
|
+
function mount(editor, content, data2) {
|
|
82739
|
+
const embed = createElement("div", ["editor-drawio-content", "editor-embed"], null);
|
|
82740
|
+
content.appendChild(embed);
|
|
82741
|
+
updateViewLayer(editor, embed, data2);
|
|
82742
|
+
if (data2.height) {
|
|
82743
|
+
content.style.height = `${data2.height}px`;
|
|
82744
|
+
embed.style.height = `${data2.height - 20}px`;
|
|
82745
|
+
}
|
|
82746
|
+
}
|
|
82747
|
+
function update$1(editor, embed, data2) {
|
|
82748
|
+
const { src, xml, xmlSvg } = data2;
|
|
82749
|
+
const preDrawioData = getPreGraphData(embed);
|
|
82750
|
+
if (src !== preDrawioData.src || (xml || "") !== preDrawioData.xml || (xmlSvg || "") !== preDrawioData.xmlSvg) {
|
|
82751
|
+
updateViewLayer(editor, embed, data2);
|
|
82752
|
+
return;
|
|
82753
|
+
}
|
|
82754
|
+
const content = embed.parentElement;
|
|
82755
|
+
const block = getParentBlock(content);
|
|
82756
|
+
if (data2.height && data2.height !== Number.parseInt(content.style.height, 10)) {
|
|
82757
|
+
content.style.height = `${data2.height}px`;
|
|
82758
|
+
if (block && !block.classList.contains("drawio-load-error")) {
|
|
82759
|
+
embed.style.height = `${data2.height - 20}px`;
|
|
82760
|
+
} else {
|
|
82761
|
+
embed.style.height = "100%";
|
|
82762
|
+
}
|
|
82763
|
+
}
|
|
82764
|
+
}
|
|
82765
|
+
function createEmbedContent$5(editor, content, blockData, path, container, block) {
|
|
82766
|
+
const drawioData = blockData.embedData;
|
|
82767
|
+
mount(editor, content, drawioData);
|
|
82768
|
+
if (!clientType.isMobile) {
|
|
82769
|
+
EmbedBlockResizer.register(editor, block);
|
|
82770
|
+
}
|
|
82771
|
+
}
|
|
82772
|
+
function handleUpdateBlock$4(editor, block, blockData) {
|
|
82773
|
+
const data2 = blockData.embedData;
|
|
82774
|
+
const content = getBlockContent(block);
|
|
82775
|
+
const embed = content.querySelector(":scope > .editor-drawio-content");
|
|
82776
|
+
assert(logger$i, embed, "embed should not be null");
|
|
82777
|
+
update$1(editor, embed, data2);
|
|
82778
|
+
return true;
|
|
82779
|
+
}
|
|
82780
|
+
function getOptions$3() {
|
|
82781
|
+
return {
|
|
82782
|
+
name: "UML",
|
|
82783
|
+
insertEmbedCommandItems: [{
|
|
82784
|
+
id: "insert-drawio",
|
|
82785
|
+
name: i18n$1.t("drawio.title"),
|
|
82786
|
+
icon: UmlIcon,
|
|
82787
|
+
group: "common",
|
|
82788
|
+
order: 600,
|
|
82789
|
+
subText: getShortcutById("insert-drawio")
|
|
82790
|
+
}],
|
|
82791
|
+
handleInsertEmptyEmbed: async (editor, options) => {
|
|
82792
|
+
const embedData = {
|
|
82793
|
+
src: "",
|
|
82794
|
+
xml: "",
|
|
82795
|
+
xmlSvg: ""
|
|
82796
|
+
};
|
|
82797
|
+
const block = editor.insertEmbed(options.containerId, options.blockIndex, "drawio", embedData);
|
|
82798
|
+
setTimeout(() => {
|
|
82799
|
+
const blockContent = getBlockContent(block);
|
|
82800
|
+
const embed = blockContent.querySelector(":scope > .editor-drawio-content");
|
|
82801
|
+
assert(logger$i, embed, "embed should not be null");
|
|
82802
|
+
const blockData = editor.getBlockData(block);
|
|
82803
|
+
editDrawIO(editor, block, embed, blockData.embedData);
|
|
82804
|
+
}, 100);
|
|
82805
|
+
return block;
|
|
82806
|
+
}
|
|
82807
|
+
};
|
|
82808
|
+
}
|
|
82809
|
+
function convertTo$5(editor, blockData, doc2, type) {
|
|
82810
|
+
const { embedData } = blockData;
|
|
82811
|
+
const data2 = embedData;
|
|
82812
|
+
if (type === "html") {
|
|
82813
|
+
if (data2.src) {
|
|
82814
|
+
return `<img src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
|
|
82815
|
+
}
|
|
82816
|
+
if (data2.xmlSvg) {
|
|
82817
|
+
return data2.xmlSvg;
|
|
82818
|
+
}
|
|
82819
|
+
return "<p>[drawio]</p>";
|
|
82820
|
+
}
|
|
82821
|
+
if (type === "markdown") {
|
|
82822
|
+
if (data2.src) {
|
|
82823
|
+
return `})`;
|
|
82824
|
+
}
|
|
82825
|
+
if (data2.xmlSvg) {
|
|
82826
|
+
return data2.xmlSvg;
|
|
82827
|
+
}
|
|
82828
|
+
return "[drawio]";
|
|
82829
|
+
}
|
|
82830
|
+
return "";
|
|
82831
|
+
}
|
|
82832
|
+
const DrawioEmbed = {
|
|
82833
|
+
embedType: "drawio",
|
|
82834
|
+
getOptions: getOptions$3,
|
|
82835
|
+
createEmbedContent: createEmbedContent$5,
|
|
82836
|
+
handleUpdateBlock: handleUpdateBlock$4,
|
|
82837
|
+
getBlockProperties: getBlockProperties$5,
|
|
82838
|
+
convertTo: convertTo$5
|
|
82839
|
+
};
|
|
82840
|
+
class DrawioPasteHandler {
|
|
82841
|
+
constructor(editor) {
|
|
82842
|
+
__publicField(this, "handleBeforePasteDoc", async (editor, doc2) => {
|
|
82843
|
+
Object.values(doc2.blocks).forEach((blocks) => {
|
|
82844
|
+
var _a;
|
|
82845
|
+
for (let i = blocks.length - 1; i >= 0; i -= 1) {
|
|
82846
|
+
const block = blocks[i];
|
|
82847
|
+
if (block.type === "embed" && block.embedType === "drawio") {
|
|
82848
|
+
const src = ((_a = block.embedData) == null ? void 0 : _a.src) || "";
|
|
82849
|
+
if (!this.isSameOrigin(editor, doc2, src)) {
|
|
82850
|
+
blocks.splice(i, 1);
|
|
82851
|
+
}
|
|
82852
|
+
}
|
|
82853
|
+
}
|
|
82854
|
+
});
|
|
82855
|
+
return false;
|
|
82856
|
+
});
|
|
82857
|
+
this.editor = editor;
|
|
82858
|
+
setTimeout(() => {
|
|
82859
|
+
this.editor.input.addHandler(this);
|
|
82860
|
+
});
|
|
82861
|
+
}
|
|
82862
|
+
isSameOrigin(editor, doc2, src) {
|
|
82863
|
+
var _a, _b;
|
|
82864
|
+
const apiServer = ((_b = (_a = editor.doc).getServerMeta) == null ? void 0 : _b.call(_a).apiServer) || window.location.origin;
|
|
82865
|
+
const origin = new URL(apiServer).origin;
|
|
82866
|
+
const docServer = src.startsWith("http") ? src : doc2.meta.apiServer;
|
|
82867
|
+
return (docServer == null ? void 0 : docServer.startsWith(origin)) || false;
|
|
82868
|
+
}
|
|
82869
|
+
destroy() {
|
|
82870
|
+
}
|
|
82871
|
+
}
|
|
82872
|
+
const style = "";
|
|
81930
82873
|
function getChildContainers(editor, block, from, to) {
|
|
81931
82874
|
const contents = Array.from(
|
|
81932
82875
|
block.querySelectorAll(':scope > .layout-root > [data-type="editor-container"].child')
|
|
@@ -81944,7 +82887,7 @@ ${content}
|
|
|
81944
82887
|
);
|
|
81945
82888
|
return contents;
|
|
81946
82889
|
}
|
|
81947
|
-
const zhCN$
|
|
82890
|
+
const zhCN$5 = {
|
|
81948
82891
|
layout: {
|
|
81949
82892
|
title: "\u5206\u680F",
|
|
81950
82893
|
columnDrag: "\u957F\u6309\u62D6\u62FD\n\u70B9\u51FB\u53EF\u64CD\u4F5C\u5220\u9664",
|
|
@@ -81953,7 +82896,7 @@ ${content}
|
|
|
81953
82896
|
currentCols: "{currentColumns} \u680F"
|
|
81954
82897
|
}
|
|
81955
82898
|
};
|
|
81956
|
-
const enUS$
|
|
82899
|
+
const enUS$5 = {
|
|
81957
82900
|
layout: {
|
|
81958
82901
|
title: "Column",
|
|
81959
82902
|
columnDrag: "Click and hold the column to drag it.\nClick to delete it.",
|
|
@@ -81962,7 +82905,7 @@ ${content}
|
|
|
81962
82905
|
currentCols: "{currentColumns} columns"
|
|
81963
82906
|
}
|
|
81964
82907
|
};
|
|
81965
|
-
const jaJP$
|
|
82908
|
+
const jaJP$5 = {
|
|
81966
82909
|
layout: {
|
|
81967
82910
|
title: "\u6BB5\u7D44\u307F",
|
|
81968
82911
|
columnDrag: "\u30C9\u30E9\u30C3\u30B0\u3059\u308B\u306B\u306F\u3001\u30DE\u30A6\u30B9\u306E\u30DC\u30BF\u30F3\u3092\u62BC\u3057\u306A\u304C\u3089\u79FB\u52D5\u3057\u307E\u3059\u3002\n\u524A\u9664\u3059\u308B\u306B\u306F\u3001\u30AF\u30EA\u30C3\u30AF\u3057\u307E\u3059\u3002",
|
|
@@ -81972,9 +82915,9 @@ ${content}
|
|
|
81972
82915
|
}
|
|
81973
82916
|
};
|
|
81974
82917
|
i18n$1.mergeLang({
|
|
81975
|
-
"zh-CN": zhCN$
|
|
81976
|
-
"en-US": enUS$
|
|
81977
|
-
"ja-JP": jaJP$
|
|
82918
|
+
"zh-CN": zhCN$5,
|
|
82919
|
+
"en-US": enUS$5,
|
|
82920
|
+
"ja-JP": jaJP$5
|
|
81978
82921
|
});
|
|
81979
82922
|
const layoutStyles = "";
|
|
81980
82923
|
const LAYOUT_NAME = "LayoutBlock";
|
|
@@ -82313,7 +83256,7 @@ ${content}
|
|
|
82313
83256
|
}
|
|
82314
83257
|
return void 0;
|
|
82315
83258
|
};
|
|
82316
|
-
const logger$
|
|
83259
|
+
const logger$h = getLogger("table-creator");
|
|
82317
83260
|
class LayoutCreatorItem {
|
|
82318
83261
|
constructor() {
|
|
82319
83262
|
__publicField(this, "id", "insert-layout");
|
|
@@ -82338,7 +83281,7 @@ ${content}
|
|
|
82338
83281
|
event.preventDefault();
|
|
82339
83282
|
event.stopPropagation();
|
|
82340
83283
|
const target = event.target;
|
|
82341
|
-
assert(logger$
|
|
83284
|
+
assert(logger$h, target instanceof HTMLElement, "invalid event target");
|
|
82342
83285
|
if (!this.colCount || this.colCount < 2) {
|
|
82343
83286
|
return;
|
|
82344
83287
|
}
|
|
@@ -82355,9 +83298,9 @@ ${content}
|
|
|
82355
83298
|
});
|
|
82356
83299
|
__publicField(this, "handleLayoutCreatorColumnEnter", (event) => {
|
|
82357
83300
|
const target = event.target;
|
|
82358
|
-
assert(logger$
|
|
83301
|
+
assert(logger$h, target instanceof HTMLElement, "invalid event target");
|
|
82359
83302
|
const id = target.id;
|
|
82360
|
-
assert(logger$
|
|
83303
|
+
assert(logger$h, id.startsWith(this.classPrefix.column), "invalid cell id");
|
|
82361
83304
|
const col = id.substring(this.classPrefix.column.length);
|
|
82362
83305
|
const colIndex = Number.parseInt(col, 10);
|
|
82363
83306
|
this.colCount = colIndex + 1;
|
|
@@ -82544,7 +83487,7 @@ ${content}
|
|
|
82544
83487
|
headingCollapsable: true,
|
|
82545
83488
|
previewNoShadow: true
|
|
82546
83489
|
});
|
|
82547
|
-
const logger$
|
|
83490
|
+
const logger$g = getLogger("layout-block");
|
|
82548
83491
|
const updateSelection = (editor, block, from, to) => {
|
|
82549
83492
|
var _a;
|
|
82550
83493
|
const childrenIds = (_a = editor.getBlockData(block).children) != null ? _a : [];
|
|
@@ -82559,8 +83502,8 @@ ${content}
|
|
|
82559
83502
|
});
|
|
82560
83503
|
};
|
|
82561
83504
|
const getSelectedContainers = (editor, complexBlock, start, end) => {
|
|
82562
|
-
assert(logger$
|
|
82563
|
-
assert(logger$
|
|
83505
|
+
assert(logger$g, start.blockId === end.blockId, "Start and end block must be the same");
|
|
83506
|
+
assert(logger$g, start.blockId === complexBlock.id, "Start block must be the same as complex block");
|
|
82564
83507
|
return getChildContainers(editor, complexBlock, start.childContainerId, end.childContainerId);
|
|
82565
83508
|
};
|
|
82566
83509
|
const getTextToolbarReferenceClient = (editor, block) => {
|
|
@@ -83294,7 +84237,7 @@ ${content}
|
|
|
83294
84237
|
}
|
|
83295
84238
|
return null;
|
|
83296
84239
|
};
|
|
83297
|
-
const getOptions$
|
|
84240
|
+
const getOptions$2 = (editor) => getLayoutOptions();
|
|
83298
84241
|
const LayoutBlock = {
|
|
83299
84242
|
blockType: LAYOUT_BLOCK_TYPE,
|
|
83300
84243
|
blockKind: "complex",
|
|
@@ -83314,7 +84257,7 @@ ${content}
|
|
|
83314
84257
|
getChildContainers: (editor, block) => getChildContainers(editor, block),
|
|
83315
84258
|
getNextContainer,
|
|
83316
84259
|
getSelectedContainers,
|
|
83317
|
-
getOptions: getOptions$
|
|
84260
|
+
getOptions: getOptions$2,
|
|
83318
84261
|
handleDrop,
|
|
83319
84262
|
handleDropOver,
|
|
83320
84263
|
getTextToolbarReferenceClient,
|
|
@@ -83345,7 +84288,7 @@ ${content}
|
|
|
83345
84288
|
}
|
|
83346
84289
|
};
|
|
83347
84290
|
const loadingIcon = '<svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M12 7.61719C11.4477 7.61719 11 7.16947 11 6.61719V3.61719C11 3.0649 11.4477 2.61719 12 2.61719C12.5523 2.61719 13 3.0649 13 3.61719V6.61719C13 7.16947 12.5523 7.61719 12 7.61719ZM4.92893 5.54612C5.31946 5.15559 5.95262 5.1556 6.34315 5.54612L8.46447 7.66744C8.85499 8.05796 8.85499 8.69113 8.46447 9.08165C8.07394 9.47218 7.44078 9.47218 7.05025 9.08165L4.92893 6.96033C4.53841 6.56981 4.53841 5.93664 4.92893 5.54612ZM15.5355 9.08165C15.145 8.69113 15.145 8.05796 15.5355 7.66744L17.6569 5.54612C18.0474 5.1556 18.6805 5.1556 19.0711 5.54612C19.4616 5.93664 19.4616 6.56981 19.0711 6.96033L16.9497 9.08165C16.5592 9.47218 15.9261 9.47218 15.5355 9.08165ZM2 12.6172C2 12.0649 2.44772 11.6172 3 11.6172L6 11.6172C6.55229 11.6172 7 12.0649 7 12.6172C7 13.1695 6.55228 13.6172 6 13.6172L3 13.6172C2.44772 13.6172 2 13.1695 2 12.6172ZM17 12.6172C17 12.0649 17.4477 11.6172 18 11.6172L21 11.6172C21.5523 11.6172 22 12.0649 22 12.6172C22 13.1695 21.5523 13.6172 21 13.6172L18 13.6172C17.4477 13.6172 17 13.1695 17 12.6172ZM15.5355 16.1527C15.9261 15.7622 16.5592 15.7622 16.9497 16.1527L19.0711 18.274C19.4616 18.6646 19.4616 19.2977 19.0711 19.6883C18.6805 20.0788 18.0474 20.0788 17.6569 19.6883L15.5355 17.5669C15.145 17.1764 15.145 16.5432 15.5355 16.1527ZM4.92893 19.6883C4.53841 19.2977 4.53841 18.6646 4.92893 18.274L7.05025 16.1527C7.44078 15.7622 8.07394 15.7622 8.46447 16.1527C8.85499 16.5432 8.85499 17.1764 8.46447 17.5669L6.34315 19.6883C5.95262 20.0788 5.31946 20.0788 4.92893 19.6883ZM12 22.6172C11.4477 22.6172 11 22.1695 11 21.6172V18.6172C11 18.0649 11.4477 17.6172 12 17.6172C12.5523 17.6172 13 18.0649 13 18.6172V21.6172C13 22.1695 12.5523 22.6172 12 22.6172Z" fill="#5587F0"/>\n<animateTransform attributeType="xml" attributeName="transform" type="rotate" values="0 12 12.5;360 12 12.5" dur="2s" repeatCount="indefinite" />\n</g>\n</svg>';
|
|
83348
|
-
const logger$
|
|
84291
|
+
const logger$f = getLogger("webpage");
|
|
83349
84292
|
class WebPage {
|
|
83350
84293
|
constructor(editor, blockData) {
|
|
83351
84294
|
__publicField(this, "currentSrc", "");
|
|
@@ -83387,7 +84330,7 @@ ${content}
|
|
|
83387
84330
|
const iframe = createElement("iframe", ["editor-preview-iframe"], internalContainer);
|
|
83388
84331
|
this.loading = this.createLoading(internalContainer);
|
|
83389
84332
|
const handleIframeLoaded = () => {
|
|
83390
|
-
assert(logger$
|
|
84333
|
+
assert(logger$f, this.loading, "not created");
|
|
83391
84334
|
this.loading.hide();
|
|
83392
84335
|
this.currentSrc = src;
|
|
83393
84336
|
};
|
|
@@ -83399,12 +84342,12 @@ ${content}
|
|
|
83399
84342
|
this.createMask(editor, block);
|
|
83400
84343
|
}
|
|
83401
84344
|
update(editor, block, embedData) {
|
|
83402
|
-
assert(logger$
|
|
84345
|
+
assert(logger$f, this.loading, "not created");
|
|
83403
84346
|
if (this.currentSrc === embedData.src) {
|
|
83404
84347
|
return;
|
|
83405
84348
|
}
|
|
83406
84349
|
const iframe = block.querySelector(".editor-preview-iframe");
|
|
83407
|
-
assert(logger$
|
|
84350
|
+
assert(logger$f, iframe, "no exists iframe");
|
|
83408
84351
|
this.loading.show();
|
|
83409
84352
|
iframe.src = embedData.src;
|
|
83410
84353
|
this.createMask(editor, block);
|
|
@@ -83520,7 +84463,7 @@ ${content}
|
|
|
83520
84463
|
}
|
|
83521
84464
|
}
|
|
83522
84465
|
const index$3 = "";
|
|
83523
|
-
const logger$
|
|
84466
|
+
const logger$e = getLogger("editor-dialog");
|
|
83524
84467
|
function createContainer(content, options) {
|
|
83525
84468
|
const container = createElement("div", ["editor-dialog-container"], null);
|
|
83526
84469
|
const header = createElement("div", ["dialog-header"], container);
|
|
@@ -83544,7 +84487,7 @@ ${content}
|
|
|
83544
84487
|
const y = document.documentElement.clientHeight / 2;
|
|
83545
84488
|
const x = document.documentElement.clientWidth / 2;
|
|
83546
84489
|
const rootElement = this.getCommandBarRoot();
|
|
83547
|
-
assert(logger$
|
|
84490
|
+
assert(logger$e, rootElement, "no command bar root");
|
|
83548
84491
|
const { width, height } = rootElement.getBoundingClientRect();
|
|
83549
84492
|
return new DOMRect(Math.max(x - width / 2, 0), Math.max(y - height / 2, 0), 0, 0);
|
|
83550
84493
|
});
|
|
@@ -83779,7 +84722,7 @@ ${content}
|
|
|
83779
84722
|
window.open(src, "_blank");
|
|
83780
84723
|
return true;
|
|
83781
84724
|
}
|
|
83782
|
-
function getBlockProperties$
|
|
84725
|
+
function getBlockProperties$4(editor, block) {
|
|
83783
84726
|
const properties = getStandardEmbedBlockProperties(editor, block, {
|
|
83784
84727
|
presetIds: [],
|
|
83785
84728
|
extCommands: editor.readonly ? [] : [{
|
|
@@ -83807,12 +84750,12 @@ ${content}
|
|
|
83807
84750
|
abstract
|
|
83808
84751
|
};
|
|
83809
84752
|
}
|
|
83810
|
-
const logger$
|
|
83811
|
-
function createEmbedContent$
|
|
84753
|
+
const logger$d = getLogger("webpage-embed");
|
|
84754
|
+
function createEmbedContent$4(editor, content, blockData, path, container, block) {
|
|
83812
84755
|
const { embedData, id } = blockData;
|
|
83813
84756
|
const { src } = embedData;
|
|
83814
84757
|
const webpage = editor.addCustom(`webpage-${id}`, () => new WebPage(editor, blockData));
|
|
83815
|
-
assert(logger$
|
|
84758
|
+
assert(logger$d, src, "The src from blockData is invalid ");
|
|
83816
84759
|
webpage.create(editor, embedData, content, block);
|
|
83817
84760
|
setTimeout(() => {
|
|
83818
84761
|
if (editor.isBlockWritable(block) && !clientType.isMobile) {
|
|
@@ -83823,7 +84766,7 @@ ${content}
|
|
|
83823
84766
|
block.style.height = `${blockData.height}px`;
|
|
83824
84767
|
}
|
|
83825
84768
|
}
|
|
83826
|
-
function handleUpdateBlock$
|
|
84769
|
+
function handleUpdateBlock$3(editor, block, blockData) {
|
|
83827
84770
|
const { embedData, id } = blockData;
|
|
83828
84771
|
const webpage = editor.getCustom(`webpage-${id}`);
|
|
83829
84772
|
webpage.update(editor, block, embedData);
|
|
@@ -83832,14 +84775,14 @@ ${content}
|
|
|
83832
84775
|
}
|
|
83833
84776
|
return true;
|
|
83834
84777
|
}
|
|
83835
|
-
function getOptions$
|
|
84778
|
+
function getOptions$1(editor) {
|
|
83836
84779
|
return {
|
|
83837
84780
|
name: "WebPage",
|
|
83838
84781
|
insertEmbedCommandItems: getAllowedWebPages(editor),
|
|
83839
84782
|
handleInsertEmptyEmbed
|
|
83840
84783
|
};
|
|
83841
84784
|
}
|
|
83842
|
-
function convertTo$
|
|
84785
|
+
function convertTo$4(editor, blockData, doc2, type) {
|
|
83843
84786
|
const webpage = blockData.embedData;
|
|
83844
84787
|
const url = webpage.src;
|
|
83845
84788
|
if (type === "html") {
|
|
@@ -83852,13 +84795,13 @@ ${content}
|
|
|
83852
84795
|
}
|
|
83853
84796
|
const WebPageEmbed = {
|
|
83854
84797
|
embedType: "webpage",
|
|
83855
|
-
createEmbedContent: createEmbedContent$
|
|
83856
|
-
getBlockProperties: getBlockProperties$
|
|
83857
|
-
getOptions: getOptions$
|
|
83858
|
-
handleUpdateBlock: handleUpdateBlock$
|
|
83859
|
-
convertTo: convertTo$
|
|
84798
|
+
createEmbedContent: createEmbedContent$4,
|
|
84799
|
+
getBlockProperties: getBlockProperties$4,
|
|
84800
|
+
getOptions: getOptions$1,
|
|
84801
|
+
handleUpdateBlock: handleUpdateBlock$3,
|
|
84802
|
+
convertTo: convertTo$4
|
|
83860
84803
|
};
|
|
83861
|
-
const zhCN$
|
|
84804
|
+
const zhCN$4 = {
|
|
83862
84805
|
webpage: {
|
|
83863
84806
|
title: "\u7F51\u9875",
|
|
83864
84807
|
youku: "\u4F18\u9177\u89C6\u9891",
|
|
@@ -83884,7 +84827,7 @@ ${content}
|
|
|
83884
84827
|
}
|
|
83885
84828
|
}
|
|
83886
84829
|
};
|
|
83887
|
-
const enUS$
|
|
84830
|
+
const enUS$4 = {
|
|
83888
84831
|
webpage: {
|
|
83889
84832
|
title: "Webpage",
|
|
83890
84833
|
youku: "Youku",
|
|
@@ -83910,7 +84853,7 @@ ${content}
|
|
|
83910
84853
|
}
|
|
83911
84854
|
}
|
|
83912
84855
|
};
|
|
83913
|
-
const jaJP$
|
|
84856
|
+
const jaJP$4 = {
|
|
83914
84857
|
webpage: {
|
|
83915
84858
|
title: "Web \u30DA\u30FC\u30B8",
|
|
83916
84859
|
youku: "Youku \u52D5\u753B",
|
|
@@ -83937,859 +84880,11 @@ ${content}
|
|
|
83937
84880
|
}
|
|
83938
84881
|
};
|
|
83939
84882
|
i18n$1.mergeLang({
|
|
83940
|
-
"zh-CN": zhCN$5,
|
|
83941
|
-
"en-US": enUS$5,
|
|
83942
|
-
"ja-JP": jaJP$5
|
|
83943
|
-
});
|
|
83944
|
-
const webpageStyle = "";
|
|
83945
|
-
function getContentTypeFromHeaders(headers) {
|
|
83946
|
-
const entries = Object.entries(headers);
|
|
83947
|
-
for (let i = 0; i < entries.length; i++) {
|
|
83948
|
-
const [key, value] = entries[i];
|
|
83949
|
-
if (key.toLocaleLowerCase() === "content-type") {
|
|
83950
|
-
return value;
|
|
83951
|
-
}
|
|
83952
|
-
}
|
|
83953
|
-
return "";
|
|
83954
|
-
}
|
|
83955
|
-
async function downloadImageToFile(editor, src, withCredentials = true) {
|
|
83956
|
-
try {
|
|
83957
|
-
const res = await editor.doc.request(src, {
|
|
83958
|
-
method: "get",
|
|
83959
|
-
responseType: "blob",
|
|
83960
|
-
withCredentials
|
|
83961
|
-
});
|
|
83962
|
-
const reader = new FileReader();
|
|
83963
|
-
const promise = new Promise((resolve, reject) => {
|
|
83964
|
-
reader.onload = resolve;
|
|
83965
|
-
reader.onerror = reject;
|
|
83966
|
-
});
|
|
83967
|
-
reader.readAsArrayBuffer(res.data);
|
|
83968
|
-
await promise;
|
|
83969
|
-
const buffer = reader.result;
|
|
83970
|
-
const contentType = getContentTypeFromHeaders(res.headers).toLocaleLowerCase();
|
|
83971
|
-
let ext = "";
|
|
83972
|
-
if (contentType) {
|
|
83973
|
-
const extensions = mime__default.default[contentType].extensions;
|
|
83974
|
-
if (extensions && extensions.length > 0) {
|
|
83975
|
-
ext = extensions[0];
|
|
83976
|
-
}
|
|
83977
|
-
}
|
|
83978
|
-
const file2 = new File([buffer], `${Date.now()}.${ext}`, {
|
|
83979
|
-
type: contentType
|
|
83980
|
-
});
|
|
83981
|
-
return file2;
|
|
83982
|
-
} catch (err) {
|
|
83983
|
-
return null;
|
|
83984
|
-
}
|
|
83985
|
-
}
|
|
83986
|
-
async function downloadObjectToFile(editor, url) {
|
|
83987
|
-
const file2 = await downloadImageToFile(editor, url);
|
|
83988
|
-
return file2;
|
|
83989
|
-
}
|
|
83990
|
-
async function downloadSvgToString(editor, url) {
|
|
83991
|
-
const file2 = await downloadObjectToFile(editor, url);
|
|
83992
|
-
if (!file2)
|
|
83993
|
-
return null;
|
|
83994
|
-
const text2 = await file2.text();
|
|
83995
|
-
return text2;
|
|
83996
|
-
}
|
|
83997
|
-
const isEmptyImage = (svg) => {
|
|
83998
|
-
if (svg.naturalWidth <= 1 && svg.naturalHeight <= 1) {
|
|
83999
|
-
return true;
|
|
84000
|
-
}
|
|
84001
|
-
return false;
|
|
84002
|
-
};
|
|
84003
|
-
const isEmptySvg = (svg) => {
|
|
84004
|
-
var _a, _b;
|
|
84005
|
-
const widthStr = (_a = svg.getAttribute("width")) != null ? _a : "";
|
|
84006
|
-
const heightStr = (_b = svg.getAttribute("height")) != null ? _b : "";
|
|
84007
|
-
const width = Number.parseInt(widthStr, 10);
|
|
84008
|
-
const height = Number.parseInt(heightStr, 10);
|
|
84009
|
-
if (!width || !height) {
|
|
84010
|
-
return true;
|
|
84011
|
-
}
|
|
84012
|
-
if (width <= 1 && height <= 1) {
|
|
84013
|
-
return true;
|
|
84014
|
-
}
|
|
84015
|
-
return false;
|
|
84016
|
-
};
|
|
84017
|
-
const getTextContent = (node) => node != null ? node[node.textContent === void 0 ? "text" : "textContent"] : "";
|
|
84018
|
-
function loopCheckResourceWasLoaded(options) {
|
|
84019
|
-
const { checker, maxRetryTime } = options;
|
|
84020
|
-
const startTime = Date.now();
|
|
84021
|
-
return new Promise((resolve, reject) => {
|
|
84022
|
-
function check() {
|
|
84023
|
-
try {
|
|
84024
|
-
if (checker()) {
|
|
84025
|
-
resolve();
|
|
84026
|
-
} else if (Date.now() - startTime > maxRetryTime) {
|
|
84027
|
-
reject(new Error("Max retry time exceeded"));
|
|
84028
|
-
} else {
|
|
84029
|
-
setTimeout(check, 100);
|
|
84030
|
-
}
|
|
84031
|
-
} catch (error2) {
|
|
84032
|
-
reject(error2);
|
|
84033
|
-
}
|
|
84034
|
-
}
|
|
84035
|
-
check();
|
|
84036
|
-
});
|
|
84037
|
-
}
|
|
84038
|
-
const DrawioLang = {
|
|
84039
|
-
"zh-CN": "zh",
|
|
84040
|
-
"zh-TW": "zh-tw",
|
|
84041
|
-
"ja-JP": "ja",
|
|
84042
|
-
"en-US": "en"
|
|
84043
|
-
};
|
|
84044
|
-
const drawioIframeUrl = "https://embed.diagrams.net/?embed=1";
|
|
84045
|
-
const DrawioJsUrl = "https://www.draw.io/embed.js";
|
|
84046
|
-
const PakoJsUrl = "https://cdn.jsdelivr.net/npm/pako@2.0.3/dist/pako.es5.js";
|
|
84047
|
-
const EmptyIcon = '<svg width="48" height="49" viewBox="0 0 48 49" fill="none" xmlns="http://www.w3.org/2000/svg">\n<rect x="27" y="18.5" width="18" height="9" stroke="#C7C7C7" stroke-width="3"/>\n<rect x="12" y="18.5" width="9" height="9" transform="rotate(45 12 18.5)" stroke="#C7C7C7" stroke-width="3"/>\n<rect x="27" y="36.5" width="18" height="9" stroke="#C7C7C7" stroke-width="3"/>\n<path d="M27 24.5L18 24.5" stroke="#C7C7C7" stroke-width="3"/>\n<path d="M28.5 41H18" stroke="#C7C7C7" stroke-width="3"/>\n<path d="M18 41H12L12 30.5" stroke="#C7C7C7" stroke-width="3"/>\n<path d="M12 21.5L12 12.5" stroke="#C7C7C7" stroke-width="3"/>\n<rect x="7.5" y="3.5" width="9" height="9" rx="4.5" stroke="#C7C7C7" stroke-width="3"/>\n</svg>\n';
|
|
84048
|
-
const DEFAULT_STYLES = `
|
|
84049
|
-
<mxStylesheet>
|
|
84050
|
-
<add as="defaultVertex">
|
|
84051
|
-
<add as="shape" value="label"/>
|
|
84052
|
-
<add as="perimeter" value="rectanglePerimeter"/>
|
|
84053
|
-
<add as="fontSize" value="12"/>
|
|
84054
|
-
<add as="fontFamily" value="Helvetica"/>
|
|
84055
|
-
<add as="align" value="center"/>
|
|
84056
|
-
<add as="verticalAlign" value="middle"/>
|
|
84057
|
-
<add as="fillColor" value="#ffffff"/>
|
|
84058
|
-
<add as="strokeColor" value="#000000"/>
|
|
84059
|
-
<add as="fontColor" value="#000000"/>
|
|
84060
|
-
</add>
|
|
84061
|
-
<add as="defaultEdge">
|
|
84062
|
-
<add as="shape" value="connector"/>
|
|
84063
|
-
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
84064
|
-
<add as="endArrow" value="classic"/>
|
|
84065
|
-
<add as="fontSize" value="11"/>
|
|
84066
|
-
<add as="fontFamily" value="Helvetica"/>
|
|
84067
|
-
<add as="align" value="center"/>
|
|
84068
|
-
<add as="verticalAlign" value="middle"/>
|
|
84069
|
-
<add as="rounded" value="1"/>
|
|
84070
|
-
<add as="strokeColor" value="#000000"/>
|
|
84071
|
-
<add as="fontColor" value="#000000"/>
|
|
84072
|
-
</add>
|
|
84073
|
-
<add as="text">
|
|
84074
|
-
<add as="fillColor" value="none"/>
|
|
84075
|
-
<add as="gradientColor" value="none"/>
|
|
84076
|
-
<add as="strokeColor" value="none"/>
|
|
84077
|
-
<add as="align" value="left"/>
|
|
84078
|
-
<add as="verticalAlign" value="top"/>
|
|
84079
|
-
</add>
|
|
84080
|
-
<add as="edgeLabel" extend="text">
|
|
84081
|
-
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
84082
|
-
<add as="fontSize" value="11"/>
|
|
84083
|
-
</add>
|
|
84084
|
-
<add as="label">
|
|
84085
|
-
<add as="fontStyle" value="1"/>
|
|
84086
|
-
<add as="align" value="left"/>
|
|
84087
|
-
<add as="verticalAlign" value="middle"/>
|
|
84088
|
-
<add as="spacing" value="2"/>
|
|
84089
|
-
<add as="spacingLeft" value="52"/>
|
|
84090
|
-
<add as="imageWidth" value="42"/>
|
|
84091
|
-
<add as="imageHeight" value="42"/>
|
|
84092
|
-
<add as="rounded" value="1"/>
|
|
84093
|
-
</add>
|
|
84094
|
-
<add as="icon" extend="label">
|
|
84095
|
-
<add as="align" value="center"/>
|
|
84096
|
-
<add as="imageAlign" value="center"/>
|
|
84097
|
-
<add as="verticalLabelPosition" value="bottom"/>
|
|
84098
|
-
<add as="verticalAlign" value="top"/>
|
|
84099
|
-
<add as="spacingTop" value="4"/>
|
|
84100
|
-
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
84101
|
-
<add as="spacing" value="0"/>
|
|
84102
|
-
<add as="spacingLeft" value="0"/>
|
|
84103
|
-
<add as="spacingTop" value="6"/>
|
|
84104
|
-
<add as="fontStyle" value="0"/>
|
|
84105
|
-
<add as="imageWidth" value="48"/>
|
|
84106
|
-
<add as="imageHeight" value="48"/>
|
|
84107
|
-
</add>
|
|
84108
|
-
<add as="swimlane">
|
|
84109
|
-
<add as="shape" value="swimlane"/>
|
|
84110
|
-
<add as="fontSize" value="12"/>
|
|
84111
|
-
<add as="fontStyle" value="1"/>
|
|
84112
|
-
<add as="startSize" value="23"/>
|
|
84113
|
-
</add>
|
|
84114
|
-
<add as="group">
|
|
84115
|
-
<add as="verticalAlign" value="top"/>
|
|
84116
|
-
<add as="fillColor" value="none"/>
|
|
84117
|
-
<add as="strokeColor" value="none"/>
|
|
84118
|
-
<add as="gradientColor" value="none"/>
|
|
84119
|
-
<add as="pointerEvents" value="0"/>
|
|
84120
|
-
</add>
|
|
84121
|
-
<add as="ellipse">
|
|
84122
|
-
<add as="shape" value="ellipse"/>
|
|
84123
|
-
<add as="perimeter" value="ellipsePerimeter"/>
|
|
84124
|
-
</add>
|
|
84125
|
-
<add as="rhombus">
|
|
84126
|
-
<add as="shape" value="rhombus"/>
|
|
84127
|
-
<add as="perimeter" value="rhombusPerimeter"/>
|
|
84128
|
-
</add>
|
|
84129
|
-
<add as="triangle">
|
|
84130
|
-
<add as="shape" value="triangle"/>
|
|
84131
|
-
<add as="perimeter" value="trianglePerimeter"/>
|
|
84132
|
-
</add>
|
|
84133
|
-
<add as="line">
|
|
84134
|
-
<add as="shape" value="line"/>
|
|
84135
|
-
<add as="strokeWidth" value="4"/>
|
|
84136
|
-
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
84137
|
-
<add as="verticalAlign" value="top"/>
|
|
84138
|
-
<add as="spacingTop" value="8"/>
|
|
84139
|
-
</add>
|
|
84140
|
-
<add as="image">
|
|
84141
|
-
<add as="shape" value="image"/>
|
|
84142
|
-
<add as="labelBackgroundColor" value="white"/>
|
|
84143
|
-
<add as="verticalAlign" value="top"/>
|
|
84144
|
-
<add as="verticalLabelPosition" value="bottom"/>
|
|
84145
|
-
</add>
|
|
84146
|
-
<add as="roundImage" extend="image">
|
|
84147
|
-
<add as="perimeter" value="ellipsePerimeter"/>
|
|
84148
|
-
</add>
|
|
84149
|
-
<add as="rhombusImage" extend="image">
|
|
84150
|
-
<add as="perimeter" value="rhombusPerimeter"/>
|
|
84151
|
-
</add>
|
|
84152
|
-
<add as="arrow">
|
|
84153
|
-
<add as="shape" value="arrow"/>
|
|
84154
|
-
<add as="edgeStyle" value="none"/>
|
|
84155
|
-
<add as="fillColor" value="#ffffff"/>
|
|
84156
|
-
</add>
|
|
84157
|
-
</mxStylesheet>
|
|
84158
|
-
`;
|
|
84159
|
-
const BORDER = 0;
|
|
84160
|
-
const SAVE_DELAY_TIME = 30 * 1e3;
|
|
84161
|
-
const DRAWIO_EMPTY_CLASS = "editor-empty-drawio";
|
|
84162
|
-
const SHOW_FULL_SCREEN_IFRAME = "show-full-screen-iframe";
|
|
84163
|
-
const logger$e = getLogger("embed-block-drawio");
|
|
84164
|
-
function getDrawioOptions(editor) {
|
|
84165
|
-
const compOptions = editor.options.componentsOptions;
|
|
84166
|
-
return compOptions.drawIO || {};
|
|
84167
|
-
}
|
|
84168
|
-
function getDrawioLang(editor) {
|
|
84169
|
-
const options = getDrawioOptions(editor);
|
|
84170
|
-
const lang = options.lang;
|
|
84171
|
-
return lang ? DrawioLang[lang] : "";
|
|
84172
|
-
}
|
|
84173
|
-
function getDrawioIframeUrl(editor) {
|
|
84174
|
-
var _a;
|
|
84175
|
-
const options = getDrawioOptions(editor) || {};
|
|
84176
|
-
const iframeUrl = ((_a = options.cdn) == null ? void 0 : _a.drawioIframe) || drawioIframeUrl;
|
|
84177
|
-
const lang = getDrawioLang(editor);
|
|
84178
|
-
return updateUrl(iframeUrl, {
|
|
84179
|
-
spin: 1,
|
|
84180
|
-
proto: "json",
|
|
84181
|
-
configure: 1,
|
|
84182
|
-
lang
|
|
84183
|
-
});
|
|
84184
|
-
}
|
|
84185
|
-
function resizeObserver(el) {
|
|
84186
|
-
const resize = () => {
|
|
84187
|
-
assert(logger$e, el, "el does not exist");
|
|
84188
|
-
const width = document.body.clientWidth || document.documentElement.clientWidth;
|
|
84189
|
-
const height = document.body.clientHeight || document.documentElement.clientHeight;
|
|
84190
|
-
el.setAttribute("width", `${width - 2 * BORDER}`);
|
|
84191
|
-
el.setAttribute("height", `${height - 2 * BORDER}`);
|
|
84192
|
-
};
|
|
84193
|
-
const disconnect = () => {
|
|
84194
|
-
window.removeEventListener("resize", resize);
|
|
84195
|
-
};
|
|
84196
|
-
resize();
|
|
84197
|
-
window.addEventListener("resize", resize);
|
|
84198
|
-
return {
|
|
84199
|
-
disconnect
|
|
84200
|
-
};
|
|
84201
|
-
}
|
|
84202
|
-
async function initializeDrawioIframe(editor, block) {
|
|
84203
|
-
const options = getDrawioOptions(editor) || {};
|
|
84204
|
-
const callbacks = options.callbacks || {};
|
|
84205
|
-
const docReAuthCallbacks = editor.getCustom(DOC_RE_AUTH_KEYS);
|
|
84206
|
-
const { onCreateDrawIoFrame, onCloseDrawIoFrame } = callbacks;
|
|
84207
|
-
let drawioIframe = null;
|
|
84208
|
-
let exit;
|
|
84209
|
-
if (onCreateDrawIoFrame) {
|
|
84210
|
-
drawioIframe = await onCreateDrawIoFrame(editor);
|
|
84211
|
-
assert(logger$e, drawioIframe, "iframe create failed");
|
|
84212
|
-
exit = () => {
|
|
84213
|
-
assert(logger$e, drawioIframe, "iframe does not exist");
|
|
84214
|
-
assert(logger$e, onCloseDrawIoFrame, "missing parameters: onCloseDrawIoFrame");
|
|
84215
|
-
docReAuthCallbacks.removeListeners();
|
|
84216
|
-
onCloseDrawIoFrame(editor, drawioIframe);
|
|
84217
|
-
};
|
|
84218
|
-
} else {
|
|
84219
|
-
const drawioContainer = createElement("div", ["editor-drawio-iframe-container", "loading"], document.body);
|
|
84220
|
-
drawioContainer.setAttribute("data-placeholder", i18n$1.t("drawio.loading"));
|
|
84221
|
-
drawioIframe = createElement("iframe", ["drawio-iframe-element"], drawioContainer);
|
|
84222
|
-
drawioIframe.setAttribute("frameborder", "0");
|
|
84223
|
-
addClass(drawioContainer, SHOW_FULL_SCREEN_IFRAME);
|
|
84224
|
-
const { disconnect } = resizeObserver(drawioIframe);
|
|
84225
|
-
exit = () => {
|
|
84226
|
-
assert(logger$e, drawioIframe, "iframe does not exist");
|
|
84227
|
-
docReAuthCallbacks.removeListeners();
|
|
84228
|
-
disconnect();
|
|
84229
|
-
document.body.removeChild(drawioContainer);
|
|
84230
|
-
removeClass(drawioContainer, SHOW_FULL_SCREEN_IFRAME);
|
|
84231
|
-
};
|
|
84232
|
-
}
|
|
84233
|
-
docReAuthCallbacks.addAuthListen("authError", () => {
|
|
84234
|
-
logger$e.debug("authError! render error toolbar");
|
|
84235
|
-
docReAuthCallbacks.reAuthToolbar.render(block, exit);
|
|
84236
|
-
});
|
|
84237
|
-
return {
|
|
84238
|
-
drawioIframe,
|
|
84239
|
-
exit
|
|
84240
|
-
};
|
|
84241
|
-
}
|
|
84242
|
-
async function saveSvgToBlock(editor, block, svg, autoSave) {
|
|
84243
|
-
var _a, _b;
|
|
84244
|
-
try {
|
|
84245
|
-
if (autoSave) {
|
|
84246
|
-
logger$e.debug("auto saving drawio data");
|
|
84247
|
-
}
|
|
84248
|
-
const regex = /(<svg [^<>]* )modified="[^&]*"([^<>]* )etag="[^&]*"/gm;
|
|
84249
|
-
const subst = "$1$2";
|
|
84250
|
-
const normalizedSvg = svg.replace(regex, subst);
|
|
84251
|
-
const blob = new Blob([normalizedSvg]);
|
|
84252
|
-
const file2 = new File([blob], "drawio.svg", {
|
|
84253
|
-
type: "image/svg+xml"
|
|
84254
|
-
});
|
|
84255
|
-
const targetBlock = editor.findBlockById(getBlockId(block));
|
|
84256
|
-
if (targetBlock) {
|
|
84257
|
-
const res = await editor.doc.uploadResource(file2);
|
|
84258
|
-
const { resourceId } = res;
|
|
84259
|
-
const oldData = editor.getBlockData(targetBlock);
|
|
84260
|
-
const oldEmbedData = oldData.embedData;
|
|
84261
|
-
const newEmbedData = {
|
|
84262
|
-
src: resourceId,
|
|
84263
|
-
height: oldEmbedData == null ? void 0 : oldEmbedData.height
|
|
84264
|
-
};
|
|
84265
|
-
editor.updateEmbedData(targetBlock, newEmbedData);
|
|
84266
|
-
} else {
|
|
84267
|
-
logger$e.error("block has been deleted");
|
|
84268
|
-
}
|
|
84269
|
-
} catch (err) {
|
|
84270
|
-
const message = `failed to save drawio data: ${err.message}`;
|
|
84271
|
-
const options = getDrawioOptions(editor);
|
|
84272
|
-
if ((_a = options.callbacks) == null ? void 0 : _a.onError) {
|
|
84273
|
-
const newError = new Error(message);
|
|
84274
|
-
newError.code = "SaveDrawIo";
|
|
84275
|
-
(_b = options.callbacks) == null ? void 0 : _b.onError(editor, newError);
|
|
84276
|
-
}
|
|
84277
|
-
throw err;
|
|
84278
|
-
}
|
|
84279
|
-
}
|
|
84280
|
-
class LoadingHandler {
|
|
84281
|
-
constructor() {
|
|
84282
|
-
__publicField(this, "loadingContainer");
|
|
84283
|
-
__publicField(this, "setLoading", (iframe, placeholder2 = i18n$1.t("drawio.save")) => {
|
|
84284
|
-
const parent = iframe.parentElement;
|
|
84285
|
-
if (parent) {
|
|
84286
|
-
addClass(parent, "loading");
|
|
84287
|
-
parent.setAttribute("data-placeholder", placeholder2);
|
|
84288
|
-
}
|
|
84289
|
-
});
|
|
84290
|
-
__publicField(this, "removeLoading", () => {
|
|
84291
|
-
const containers = document.querySelectorAll(".editor-drawio-iframe-container");
|
|
84292
|
-
containers.forEach((r) => {
|
|
84293
|
-
removeClass(r, "loading");
|
|
84294
|
-
});
|
|
84295
|
-
});
|
|
84296
|
-
}
|
|
84297
|
-
}
|
|
84298
|
-
function contactWithIframe(editor, block, drawIoData, iframe, loaded, exit, isInitializationCompleted2) {
|
|
84299
|
-
const destroy = () => {
|
|
84300
|
-
window.removeEventListener("message", receive);
|
|
84301
|
-
exit();
|
|
84302
|
-
};
|
|
84303
|
-
const loadingHandler = new LoadingHandler();
|
|
84304
|
-
loadingHandler.setLoading(iframe, i18n$1.t("drawio.loading"));
|
|
84305
|
-
let exportFlag = "auto";
|
|
84306
|
-
const receive = async (evt) => {
|
|
84307
|
-
var _a, _b;
|
|
84308
|
-
assert(logger$e, iframe.contentWindow, "iframe.contentWindow does not exist");
|
|
84309
|
-
if (evt.data.length > 0) {
|
|
84310
|
-
const msg = JSON.parse(evt.data);
|
|
84311
|
-
const xml = drawIoData.xmlSvg || drawIoData.xml;
|
|
84312
|
-
switch (msg.event) {
|
|
84313
|
-
case "configure":
|
|
84314
|
-
iframe.contentWindow.postMessage(JSON.stringify({
|
|
84315
|
-
action: "configure",
|
|
84316
|
-
config: {
|
|
84317
|
-
defaultFonts: ["Humor Sans", "Helvetica", "Times New Roman"]
|
|
84318
|
-
}
|
|
84319
|
-
}), "*");
|
|
84320
|
-
break;
|
|
84321
|
-
case "init":
|
|
84322
|
-
if (xml != null) {
|
|
84323
|
-
iframe.contentWindow.postMessage(JSON.stringify({
|
|
84324
|
-
action: "load",
|
|
84325
|
-
saveAndExit: 1,
|
|
84326
|
-
noSaveBtn: 1,
|
|
84327
|
-
noExitBtn: 0,
|
|
84328
|
-
xml
|
|
84329
|
-
}), "*");
|
|
84330
|
-
}
|
|
84331
|
-
loaded();
|
|
84332
|
-
loadingHandler.removeLoading();
|
|
84333
|
-
break;
|
|
84334
|
-
case "save":
|
|
84335
|
-
exportFlag = "save";
|
|
84336
|
-
iframe.contentWindow.postMessage(JSON.stringify({
|
|
84337
|
-
action: "export",
|
|
84338
|
-
format: "xmlsvg",
|
|
84339
|
-
spin: "Saving graph"
|
|
84340
|
-
}), "*");
|
|
84341
|
-
break;
|
|
84342
|
-
case "export":
|
|
84343
|
-
if (exportFlag !== "auto") {
|
|
84344
|
-
loadingHandler.setLoading(iframe);
|
|
84345
|
-
}
|
|
84346
|
-
const svg = fromBase64(msg.data.substring(msg.data.indexOf(",") + 1));
|
|
84347
|
-
try {
|
|
84348
|
-
await saveSvgToBlock(editor, block, svg, !!((_a = msg.message) == null ? void 0 : _a.autoSave));
|
|
84349
|
-
if (!((_b = msg.message) == null ? void 0 : _b.autoSave)) {
|
|
84350
|
-
destroy();
|
|
84351
|
-
}
|
|
84352
|
-
} catch (error2) {
|
|
84353
|
-
const docReAuthCallbacks = editor.getCustom(DOC_RE_AUTH_KEYS);
|
|
84354
|
-
docReAuthCallbacks.emit("tokenExpired");
|
|
84355
|
-
if (exportFlag === "save") {
|
|
84356
|
-
docReAuthCallbacks.reAuthToolbar.render(block, exit);
|
|
84357
|
-
}
|
|
84358
|
-
}
|
|
84359
|
-
loadingHandler.removeLoading();
|
|
84360
|
-
exportFlag = "auto";
|
|
84361
|
-
break;
|
|
84362
|
-
case "exit":
|
|
84363
|
-
exportFlag = "exit";
|
|
84364
|
-
destroy();
|
|
84365
|
-
break;
|
|
84366
|
-
}
|
|
84367
|
-
}
|
|
84368
|
-
};
|
|
84369
|
-
window.addEventListener("message", receive);
|
|
84370
|
-
}
|
|
84371
|
-
async function editGraph(editor, block, data2, isInitializationCompleted2) {
|
|
84372
|
-
if (isInitializationCompleted2) {
|
|
84373
|
-
return;
|
|
84374
|
-
}
|
|
84375
|
-
isInitializationCompleted2 = true;
|
|
84376
|
-
const options = getDrawioOptions(editor) || {};
|
|
84377
|
-
const { callbacks } = options;
|
|
84378
|
-
let autoSaveInterval;
|
|
84379
|
-
if (callbacks && (callbacks == null ? void 0 : callbacks.onBeginInitDrawIo)) {
|
|
84380
|
-
callbacks.onBeginInitDrawIo(editor, block);
|
|
84381
|
-
}
|
|
84382
|
-
const { drawioIframe, exit: exitIframe } = await initializeDrawioIframe(editor, block);
|
|
84383
|
-
exclusiveBlock(editor, block);
|
|
84384
|
-
if (data2.src) {
|
|
84385
|
-
const svg = await downloadSvgToString(editor, editor.doc.buildResourceUrl(data2.src));
|
|
84386
|
-
if (svg) {
|
|
84387
|
-
data2.xmlSvg = svg;
|
|
84388
|
-
}
|
|
84389
|
-
}
|
|
84390
|
-
const loaded = () => {
|
|
84391
|
-
autoSaveInterval = setInterval(() => {
|
|
84392
|
-
if (!drawioIframe || !drawioIframe.contentWindow) {
|
|
84393
|
-
return;
|
|
84394
|
-
}
|
|
84395
|
-
drawioIframe.contentWindow.postMessage(JSON.stringify({
|
|
84396
|
-
action: "export",
|
|
84397
|
-
format: "xmlsvg",
|
|
84398
|
-
spin: "Saving graph",
|
|
84399
|
-
autoSave: true
|
|
84400
|
-
}), "*");
|
|
84401
|
-
}, SAVE_DELAY_TIME);
|
|
84402
|
-
};
|
|
84403
|
-
const exit = () => {
|
|
84404
|
-
exitIframe();
|
|
84405
|
-
if (autoSaveInterval) {
|
|
84406
|
-
clearInterval(autoSaveInterval);
|
|
84407
|
-
}
|
|
84408
|
-
const newBlock = editor.findBlockById(getBlockId(block));
|
|
84409
|
-
if (newBlock) {
|
|
84410
|
-
unexclusiveBlock(editor, newBlock);
|
|
84411
|
-
}
|
|
84412
|
-
};
|
|
84413
|
-
contactWithIframe(editor, block, data2, drawioIframe, loaded, exit);
|
|
84414
|
-
const iframeUrl = getDrawioIframeUrl(editor);
|
|
84415
|
-
drawioIframe.setAttribute("src", iframeUrl);
|
|
84416
|
-
}
|
|
84417
|
-
async function initDrawIo(editor) {
|
|
84418
|
-
var _a, _b;
|
|
84419
|
-
const option = getDrawioOptions(editor);
|
|
84420
|
-
const drawIoUrl = ((_a = option.cdn) == null ? void 0 : _a.drawio) || DrawioJsUrl;
|
|
84421
|
-
const pakoUrl = ((_b = option.cdn) == null ? void 0 : _b.pako) || PakoJsUrl;
|
|
84422
|
-
await loadJsPromise(pakoUrl, "editor-pako");
|
|
84423
|
-
await loadJsPromise(drawIoUrl, "editor-drawio");
|
|
84424
|
-
}
|
|
84425
|
-
function removeDrawioEmptyStatus(embed) {
|
|
84426
|
-
removeClass(embed, DRAWIO_EMPTY_CLASS);
|
|
84427
|
-
}
|
|
84428
|
-
function addDrawioEmptyStatus(embed) {
|
|
84429
|
-
addClass(embed, DRAWIO_EMPTY_CLASS);
|
|
84430
|
-
const emptyContent = createElement("div", ["drawio-empty-content"], embed);
|
|
84431
|
-
emptyContent.innerHTML = EmptyIcon;
|
|
84432
|
-
createElement("span", ["drawio-empty-title"], emptyContent, i18n$1.t("drawio.empty"));
|
|
84433
|
-
}
|
|
84434
|
-
function addDrawioLoadErrorStatus(editor, embed, data2) {
|
|
84435
|
-
const block = getParentBlock(embed);
|
|
84436
|
-
if (!block) {
|
|
84437
|
-
return;
|
|
84438
|
-
}
|
|
84439
|
-
const blockContent = getBlockContent(block);
|
|
84440
|
-
embed.innerHTML = "";
|
|
84441
|
-
embed.style.height = "100%";
|
|
84442
|
-
addClass(block, "drawio-load-error");
|
|
84443
|
-
const errorContent = createElement("div", ["drawio-error-content"], embed);
|
|
84444
|
-
const brandIcon = createElement("div", ["drawio-error-brand-icon"], errorContent);
|
|
84445
|
-
brandIcon.innerHTML = UmlBrandIcon;
|
|
84446
|
-
createElement("div", ["drawio-error-title"], errorContent, i18n$1.t("drawio.errorTips"));
|
|
84447
|
-
const subTitle = createElement("div", ["drawio-error-sub-title"], errorContent);
|
|
84448
|
-
createElement("span", [], subTitle, i18n$1.t("drawio.errorSubTips"));
|
|
84449
|
-
const retryButton = createElement("span", ["drawio-error-retry-button"], subTitle, i18n$1.t("drawio.retry"));
|
|
84450
|
-
retryButton.onclick = () => {
|
|
84451
|
-
embed.innerHTML = "";
|
|
84452
|
-
removeClass(block, "drawio-load-error");
|
|
84453
|
-
if (data2.src) {
|
|
84454
|
-
updateGraphBySrc(data2.src, embed, editor);
|
|
84455
|
-
} else if (data2.xml) {
|
|
84456
|
-
updateGraphByXml(data2.xml, embed, editor);
|
|
84457
|
-
} else if (data2.xmlSvg) {
|
|
84458
|
-
updateGraphByXmlSvg(data2.xmlSvg, embed);
|
|
84459
|
-
}
|
|
84460
|
-
if (data2.height) {
|
|
84461
|
-
blockContent.style.height = `${data2.height}px`;
|
|
84462
|
-
embed.style.height = `${data2.height - 20}px`;
|
|
84463
|
-
}
|
|
84464
|
-
};
|
|
84465
|
-
}
|
|
84466
|
-
function setGraph(embed, data2) {
|
|
84467
|
-
assert(logger$e, data2, "Required data is missing in setGraph");
|
|
84468
|
-
if ("src" in data2) {
|
|
84469
|
-
embed.setAttribute("data-src", data2.src);
|
|
84470
|
-
return;
|
|
84471
|
-
}
|
|
84472
|
-
if ("xmlSvg" in data2) {
|
|
84473
|
-
embed.setAttribute("data-xmlsvg", data2.xmlSvg);
|
|
84474
|
-
return;
|
|
84475
|
-
}
|
|
84476
|
-
if ("graph" in data2) {
|
|
84477
|
-
const { xml, graph: graph2 } = data2;
|
|
84478
|
-
embed.graph = graph2;
|
|
84479
|
-
embed.setAttribute("data-mxfile", xml);
|
|
84480
|
-
}
|
|
84481
|
-
}
|
|
84482
|
-
function getPreGraphData(embed) {
|
|
84483
|
-
return {
|
|
84484
|
-
src: embed.getAttribute("data-src") || "",
|
|
84485
|
-
xmlSvg: embed.getAttribute("data-xmlsvg") || "",
|
|
84486
|
-
xml: embed.getAttribute("data-mxfile") || ""
|
|
84487
|
-
};
|
|
84488
|
-
}
|
|
84489
|
-
function updateGraphBySrc(src, embed, editor) {
|
|
84490
|
-
assert(logger$e, src, "params error: src");
|
|
84491
|
-
assert(logger$e, editor, "params error: editor");
|
|
84492
|
-
const embedEl = embed;
|
|
84493
|
-
const url = editor.doc.buildResourceUrl(src, {
|
|
84494
|
-
syncNewResources: async (resourceId, resourceUrl) => {
|
|
84495
|
-
var _a, _b;
|
|
84496
|
-
await editor.doc.addResources([resourceId]);
|
|
84497
|
-
const serviceAppId = (_b = (_a = editor.doc).getServerMeta) == null ? void 0 : _b.call(_a).appId;
|
|
84498
|
-
if (resourceUrl !== src && serviceAppId && src.includes(serviceAppId)) {
|
|
84499
|
-
const block = getParentBlock(embed);
|
|
84500
|
-
if (block && !editor.readonly && editor.isBlockWritable(block)) {
|
|
84501
|
-
const newBlockData = cloneDeep__default.default(editor.getBlockData(block));
|
|
84502
|
-
newBlockData.embedData.src = resourceId;
|
|
84503
|
-
editor.updateBlockData(block, newBlockData);
|
|
84504
|
-
}
|
|
84505
|
-
}
|
|
84506
|
-
}
|
|
84507
|
-
});
|
|
84508
|
-
const img = document.createElement("img");
|
|
84509
|
-
embedEl.innerHTML = "";
|
|
84510
|
-
embedEl.appendChild(img);
|
|
84511
|
-
img.src = url;
|
|
84512
|
-
img.draggable = false;
|
|
84513
|
-
setGraph(embedEl, { src });
|
|
84514
|
-
img.onload = (e2) => {
|
|
84515
|
-
const img2 = embedEl.querySelector("img");
|
|
84516
|
-
if (e2.target !== img2 || !img2) {
|
|
84517
|
-
return;
|
|
84518
|
-
}
|
|
84519
|
-
if (isEmptyImage(img2)) {
|
|
84520
|
-
addDrawioEmptyStatus(embed);
|
|
84521
|
-
} else {
|
|
84522
|
-
removeDrawioEmptyStatus(embed);
|
|
84523
|
-
}
|
|
84524
|
-
};
|
|
84525
|
-
img.onerror = (e2) => {
|
|
84526
|
-
const img2 = embedEl.querySelector("img");
|
|
84527
|
-
if (e2.target !== img2) {
|
|
84528
|
-
return;
|
|
84529
|
-
}
|
|
84530
|
-
addDrawioLoadErrorStatus(editor, embed, {
|
|
84531
|
-
src
|
|
84532
|
-
});
|
|
84533
|
-
};
|
|
84534
|
-
}
|
|
84535
|
-
function updateGraphByXml(mxFile, embed, editor) {
|
|
84536
|
-
assert(logger$e, editor, "parameter missing");
|
|
84537
|
-
initDrawIo(editor).then(() => loopCheckResourceWasLoaded({
|
|
84538
|
-
checker: () => !!(window.mxUtils && window.mxGraph && window.mxCodec),
|
|
84539
|
-
maxRetryTime: 5e3
|
|
84540
|
-
})).then(() => {
|
|
84541
|
-
const { mxUtils, mxGraph: MxGraph, mxCodec: MxCodec } = window;
|
|
84542
|
-
assert(logger$e, mxUtils, "External resource loading exception: mxUtils");
|
|
84543
|
-
assert(logger$e, MxGraph, "External resource loading exception: MxGraph");
|
|
84544
|
-
assert(logger$e, MxCodec, "External resource loading exception: MxCodec");
|
|
84545
|
-
const file2 = mxUtils.parseXml(mxFile);
|
|
84546
|
-
embed.innerHTML = "";
|
|
84547
|
-
const node = file2.documentElement;
|
|
84548
|
-
assert(logger$e, node, "Resource parsing exception");
|
|
84549
|
-
assert(logger$e, node.nodeName === "mxfile", "Resource parsing exception");
|
|
84550
|
-
const diagrams = node.getElementsByTagName("diagram");
|
|
84551
|
-
assert(logger$e, diagrams.length > 0, "Resource parsing exception");
|
|
84552
|
-
let xmlDoc;
|
|
84553
|
-
const data2 = diagrams[0];
|
|
84554
|
-
if (data2.text || data2.textContent.trim()) {
|
|
84555
|
-
const diagramBase64 = getTextContent(data2);
|
|
84556
|
-
const raw = atob(diagramBase64);
|
|
84557
|
-
const pako = window.pako;
|
|
84558
|
-
assert(logger$e, pako, "External resource loading exception: pako");
|
|
84559
|
-
const encodedXml = pako.inflateRaw(Uint8Array.from(raw, (c) => c.charCodeAt(0)), { to: "string" });
|
|
84560
|
-
const xml = decodeURIComponent(encodedXml);
|
|
84561
|
-
xmlDoc = mxUtils.parseXml(xml);
|
|
84562
|
-
} else {
|
|
84563
|
-
const xml = new XMLSerializer().serializeToString(data2.firstElementChild);
|
|
84564
|
-
xmlDoc = mxUtils.parseXml(xml);
|
|
84565
|
-
}
|
|
84566
|
-
const graph2 = new MxGraph(embed);
|
|
84567
|
-
graph2.resetViewOnRootChange = false;
|
|
84568
|
-
graph2.foldingEnabled = false;
|
|
84569
|
-
graph2.setTooltips(false);
|
|
84570
|
-
graph2.setEnabled(false);
|
|
84571
|
-
graph2.setHtmlLabels(true);
|
|
84572
|
-
const styleDoc = mxUtils.parseXml(DEFAULT_STYLES);
|
|
84573
|
-
const dec = new MxCodec(styleDoc);
|
|
84574
|
-
dec.decode(styleDoc.documentElement, graph2.getStylesheet());
|
|
84575
|
-
const codec = new MxCodec(xmlDoc);
|
|
84576
|
-
codec.decode(codec.document.documentElement, graph2.getModel());
|
|
84577
|
-
graph2.maxFitScale = 1;
|
|
84578
|
-
graph2.fit();
|
|
84579
|
-
graph2.center(true, false);
|
|
84580
|
-
setGraph(embed, { graph: graph2, xml: mxFile });
|
|
84581
|
-
}).catch((err) => {
|
|
84582
|
-
logger$e.error("Failed to Init DrawIo", err);
|
|
84583
|
-
});
|
|
84584
|
-
}
|
|
84585
|
-
function updateGraphByXmlSvg(xmlSvg, embed) {
|
|
84586
|
-
embed.innerHTML = xmlSvg;
|
|
84587
|
-
setGraph(embed, { xmlSvg });
|
|
84588
|
-
const svgElements = embed.querySelectorAll("svg");
|
|
84589
|
-
for (let i = 0; i < svgElements.length; i++) {
|
|
84590
|
-
const svg = svgElements[i];
|
|
84591
|
-
if (!isEmptySvg(svg)) {
|
|
84592
|
-
return;
|
|
84593
|
-
}
|
|
84594
|
-
}
|
|
84595
|
-
addDrawioEmptyStatus(embed);
|
|
84596
|
-
}
|
|
84597
|
-
function getBlockProperties$4(editor, block) {
|
|
84598
|
-
const properties = getStandardEmbedBlockProperties(editor, block, {
|
|
84599
|
-
handleExecuteCommand: (editor2, block2, item) => {
|
|
84600
|
-
if (item.id === "edit") {
|
|
84601
|
-
const data2 = editor2.getBlockData(block2).embedData;
|
|
84602
|
-
editGraph(editor2, block2, data2, false);
|
|
84603
|
-
return true;
|
|
84604
|
-
}
|
|
84605
|
-
if (item.id === "download") {
|
|
84606
|
-
const image = block2.querySelector(".editor-drawio-content img");
|
|
84607
|
-
if (!(image instanceof HTMLImageElement))
|
|
84608
|
-
return true;
|
|
84609
|
-
downloadImageAsPng(image.src);
|
|
84610
|
-
return true;
|
|
84611
|
-
}
|
|
84612
|
-
return false;
|
|
84613
|
-
},
|
|
84614
|
-
extCommands: (editor2, block2) => {
|
|
84615
|
-
const blockContent = getBlockContent(block2);
|
|
84616
|
-
const drawioImg = blockContent.querySelector(".editor-drawio-content img");
|
|
84617
|
-
return [{
|
|
84618
|
-
id: "download",
|
|
84619
|
-
name: i18n$1.t("common.downloadAsImage"),
|
|
84620
|
-
icon: DownloadIcon$1,
|
|
84621
|
-
states: !drawioImg ? ["disabled"] : []
|
|
84622
|
-
}];
|
|
84623
|
-
},
|
|
84624
|
-
presetIds: ["edit"],
|
|
84625
|
-
extIds: ["separator"]
|
|
84626
|
-
});
|
|
84627
|
-
return { ...properties, abstract: i18n$1.t("drawio.abstract") };
|
|
84628
|
-
}
|
|
84629
|
-
const enUS$4 = {
|
|
84630
|
-
drawio: {
|
|
84631
|
-
title: "Flowchart/UML",
|
|
84632
|
-
empty: "Empty graph",
|
|
84633
|
-
loading: "Loading",
|
|
84634
|
-
abstract: "Flowchart/UML",
|
|
84635
|
-
errorTips: "Flowchart/UML loading failed",
|
|
84636
|
-
errorSubTips: "The network service is abnormal, you can",
|
|
84637
|
-
retry: "Try again",
|
|
84638
|
-
save: "Saving"
|
|
84639
|
-
}
|
|
84640
|
-
};
|
|
84641
|
-
const zhCN$4 = {
|
|
84642
|
-
drawio: {
|
|
84643
|
-
title: "\u6D41\u7A0B\u56FE/UML",
|
|
84644
|
-
empty: "\u7A7A\u56FE\u8868",
|
|
84645
|
-
loading: "\u52A0\u8F7D\u4E2D",
|
|
84646
|
-
abstract: "\u6D41\u7A0B\u56FE/UML",
|
|
84647
|
-
errorTips: "\u6D41\u7A0B\u56FE/UML\u52A0\u8F7D\u5931\u8D25",
|
|
84648
|
-
errorSubTips: "\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5",
|
|
84649
|
-
retry: "\u91CD\u8BD5",
|
|
84650
|
-
save: "\u4FDD\u5B58\u4E2D"
|
|
84651
|
-
}
|
|
84652
|
-
};
|
|
84653
|
-
const jaJP$4 = {
|
|
84654
|
-
drawio: {
|
|
84655
|
-
title: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",
|
|
84656
|
-
empty: "\u30B0\u30E9\u30D5\u30C7\u30FC\u30BF\u306A\u3057",
|
|
84657
|
-
loading: "\u8AAD\u8FBC\u4E2D",
|
|
84658
|
-
abstract: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",
|
|
84659
|
-
errorTips: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML \u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
84660
|
-
errorSubTips: "\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 ",
|
|
84661
|
-
retry: "\u518D\u8A66\u884C",
|
|
84662
|
-
save: "\u4FDD\u5B58\u4E2D"
|
|
84663
|
-
}
|
|
84664
|
-
};
|
|
84665
|
-
const langs = {
|
|
84666
|
-
"en-US": enUS$4,
|
|
84667
84883
|
"zh-CN": zhCN$4,
|
|
84884
|
+
"en-US": enUS$4,
|
|
84668
84885
|
"ja-JP": jaJP$4
|
|
84669
|
-
};
|
|
84670
|
-
|
|
84671
|
-
const logger$d = getLogger("embed-block-drawio");
|
|
84672
|
-
const isInitializationCompleted = false;
|
|
84673
|
-
function editDrawIO(editor, block, embed, data2) {
|
|
84674
|
-
assert(logger$d, embed, `parameter missing: ${embed}`);
|
|
84675
|
-
assert(logger$d, editor, `parameter missing: ${editor}`);
|
|
84676
|
-
editGraph(editor, block, data2, isInitializationCompleted);
|
|
84677
|
-
}
|
|
84678
|
-
function updateViewLayer(editor, embed, data2) {
|
|
84679
|
-
const { src, xml, xmlSvg } = data2;
|
|
84680
|
-
if (src) {
|
|
84681
|
-
updateGraphBySrc(src, embed, editor);
|
|
84682
|
-
} else if (xml) {
|
|
84683
|
-
updateGraphByXml(xml, embed, editor);
|
|
84684
|
-
} else if (xmlSvg) {
|
|
84685
|
-
updateGraphByXmlSvg(xmlSvg, embed);
|
|
84686
|
-
} else {
|
|
84687
|
-
addDrawioEmptyStatus(embed);
|
|
84688
|
-
}
|
|
84689
|
-
}
|
|
84690
|
-
function mount(editor, content, data2) {
|
|
84691
|
-
const embed = createElement("div", ["editor-drawio-content", "editor-embed"], null);
|
|
84692
|
-
content.appendChild(embed);
|
|
84693
|
-
updateViewLayer(editor, embed, data2);
|
|
84694
|
-
if (data2.height) {
|
|
84695
|
-
content.style.height = `${data2.height}px`;
|
|
84696
|
-
embed.style.height = `${data2.height - 20}px`;
|
|
84697
|
-
}
|
|
84698
|
-
}
|
|
84699
|
-
function update$1(editor, embed, data2) {
|
|
84700
|
-
const { src, xml, xmlSvg } = data2;
|
|
84701
|
-
const preDrawioData = getPreGraphData(embed);
|
|
84702
|
-
if (src !== preDrawioData.src || (xml || "") !== preDrawioData.xml || (xmlSvg || "") !== preDrawioData.xmlSvg) {
|
|
84703
|
-
updateViewLayer(editor, embed, data2);
|
|
84704
|
-
return;
|
|
84705
|
-
}
|
|
84706
|
-
const content = embed.parentElement;
|
|
84707
|
-
const block = getParentBlock(content);
|
|
84708
|
-
if (data2.height && data2.height !== Number.parseInt(content.style.height, 10)) {
|
|
84709
|
-
content.style.height = `${data2.height}px`;
|
|
84710
|
-
if (block && !block.classList.contains("drawio-load-error")) {
|
|
84711
|
-
embed.style.height = `${data2.height - 20}px`;
|
|
84712
|
-
} else {
|
|
84713
|
-
embed.style.height = "100%";
|
|
84714
|
-
}
|
|
84715
|
-
}
|
|
84716
|
-
}
|
|
84717
|
-
function createEmbedContent$4(editor, content, blockData, path, container, block) {
|
|
84718
|
-
const drawioData = blockData.embedData;
|
|
84719
|
-
mount(editor, content, drawioData);
|
|
84720
|
-
if (!clientType.isMobile) {
|
|
84721
|
-
EmbedBlockResizer.register(editor, block);
|
|
84722
|
-
}
|
|
84723
|
-
}
|
|
84724
|
-
function handleUpdateBlock$3(editor, block, blockData) {
|
|
84725
|
-
const data2 = blockData.embedData;
|
|
84726
|
-
const content = getBlockContent(block);
|
|
84727
|
-
const embed = content.querySelector(":scope > .editor-drawio-content");
|
|
84728
|
-
assert(logger$d, embed, "embed should not be null");
|
|
84729
|
-
update$1(editor, embed, data2);
|
|
84730
|
-
return true;
|
|
84731
|
-
}
|
|
84732
|
-
function getOptions$1() {
|
|
84733
|
-
return {
|
|
84734
|
-
name: "UML",
|
|
84735
|
-
insertEmbedCommandItems: [{
|
|
84736
|
-
id: "insert-drawio",
|
|
84737
|
-
name: i18n$1.t("drawio.title"),
|
|
84738
|
-
icon: UmlIcon,
|
|
84739
|
-
group: "common",
|
|
84740
|
-
order: 600,
|
|
84741
|
-
subText: getShortcutById("insert-drawio")
|
|
84742
|
-
}],
|
|
84743
|
-
handleInsertEmptyEmbed: async (editor, options) => {
|
|
84744
|
-
const embedData = {
|
|
84745
|
-
src: "",
|
|
84746
|
-
xml: "",
|
|
84747
|
-
xmlSvg: ""
|
|
84748
|
-
};
|
|
84749
|
-
const block = editor.insertEmbed(options.containerId, options.blockIndex, "drawio", embedData);
|
|
84750
|
-
setTimeout(() => {
|
|
84751
|
-
const blockContent = getBlockContent(block);
|
|
84752
|
-
const embed = blockContent.querySelector(":scope > .editor-drawio-content");
|
|
84753
|
-
assert(logger$d, embed, "embed should not be null");
|
|
84754
|
-
const blockData = editor.getBlockData(block);
|
|
84755
|
-
editDrawIO(editor, block, embed, blockData.embedData);
|
|
84756
|
-
}, 100);
|
|
84757
|
-
return block;
|
|
84758
|
-
}
|
|
84759
|
-
};
|
|
84760
|
-
}
|
|
84761
|
-
function convertTo$4(editor, blockData, doc2, type) {
|
|
84762
|
-
const { embedData } = blockData;
|
|
84763
|
-
const data2 = embedData;
|
|
84764
|
-
if (type === "html") {
|
|
84765
|
-
if (data2.src) {
|
|
84766
|
-
return `<img src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
|
|
84767
|
-
}
|
|
84768
|
-
if (data2.xmlSvg) {
|
|
84769
|
-
return data2.xmlSvg;
|
|
84770
|
-
}
|
|
84771
|
-
return "<p>[drawio]</p>";
|
|
84772
|
-
}
|
|
84773
|
-
if (type === "markdown") {
|
|
84774
|
-
if (data2.src) {
|
|
84775
|
-
return `})`;
|
|
84776
|
-
}
|
|
84777
|
-
if (data2.xmlSvg) {
|
|
84778
|
-
return data2.xmlSvg;
|
|
84779
|
-
}
|
|
84780
|
-
return "[drawio]";
|
|
84781
|
-
}
|
|
84782
|
-
return "";
|
|
84783
|
-
}
|
|
84784
|
-
const DrawioEmbed = {
|
|
84785
|
-
embedType: "drawio",
|
|
84786
|
-
getOptions: getOptions$1,
|
|
84787
|
-
createEmbedContent: createEmbedContent$4,
|
|
84788
|
-
handleUpdateBlock: handleUpdateBlock$3,
|
|
84789
|
-
getBlockProperties: getBlockProperties$4,
|
|
84790
|
-
convertTo: convertTo$4
|
|
84791
|
-
};
|
|
84792
|
-
const style = "";
|
|
84886
|
+
});
|
|
84887
|
+
const webpageStyle = "";
|
|
84793
84888
|
const index$2 = "";
|
|
84794
84889
|
const UPDATE_DELAY = 500;
|
|
84795
84890
|
const DEFAULT_EDIT_CODE_HEIGHT = 300;
|
|
@@ -88297,7 +88392,6 @@ ${data2.flowchartText}
|
|
|
88297
88392
|
editor.input.addHandler(new ListPasteHandler());
|
|
88298
88393
|
editor.doc.registerCallback(new HeadingBlockDocEvents(editor));
|
|
88299
88394
|
editor.addCustom("remote-cursor", () => new RemoteCarets(editor));
|
|
88300
|
-
editor.addCustom("block-attributes-handler", () => new BlockAttributesHandler(editor));
|
|
88301
88395
|
if (!clientType.isMobile) {
|
|
88302
88396
|
editor.addCustom("editor-quick-menu", () => {
|
|
88303
88397
|
var _a2;
|
|
@@ -88323,6 +88417,7 @@ ${data2.flowchartText}
|
|
|
88323
88417
|
editor.addCustom("list-to-mention", () => new OnesEditorBlockMention(editor));
|
|
88324
88418
|
editor.addCustom("code-caret", () => new OnesEditorCodeCaret(editor));
|
|
88325
88419
|
editor.addCustom("image-paste-handler", () => new ImagePasteHandler(editor));
|
|
88420
|
+
editor.addCustom("drawio-paste-handler", () => new DrawioPasteHandler(editor));
|
|
88326
88421
|
editor.addCustom("layout-paste-handler", () => new LayoutBlockCaptionInputHandler(editor, true));
|
|
88327
88422
|
if ((_k = options.componentsOptions) == null ? void 0 : _k.mention) {
|
|
88328
88423
|
const mentionOptions = options.componentsOptions.mention;
|
|
@@ -88382,7 +88477,7 @@ ${data2.flowchartText}
|
|
|
88382
88477
|
}
|
|
88383
88478
|
}
|
|
88384
88479
|
});
|
|
88385
|
-
editor.version = "2.2.16-beta.
|
|
88480
|
+
editor.version = "2.2.16-beta.11";
|
|
88386
88481
|
return editor;
|
|
88387
88482
|
}
|
|
88388
88483
|
function isDoc(doc2) {
|
|
@@ -88434,7 +88529,6 @@ ${data2.flowchartText}
|
|
|
88434
88529
|
editor.input.addHandler(new OnesEditorPasteHandler(editor));
|
|
88435
88530
|
editor.input.addHandler(new BlockLockerPasteHandler());
|
|
88436
88531
|
editor.input.addHandler(new ListPasteHandler());
|
|
88437
|
-
editor.addCustom("block-attributes-handler", () => new BlockAttributesHandler(editor));
|
|
88438
88532
|
if (!clientType.isMobile) {
|
|
88439
88533
|
editor.addCustom("editor-quick-menu", () => {
|
|
88440
88534
|
var _a2;
|
|
@@ -88448,6 +88542,7 @@ ${data2.flowchartText}
|
|
|
88448
88542
|
} else {
|
|
88449
88543
|
editor.addCustom("mobile-helper", () => new OnesEditorMobileHelper(editor));
|
|
88450
88544
|
}
|
|
88545
|
+
editor.addCustom("drawio-paste-handler", () => new DrawioPasteHandler(editor));
|
|
88451
88546
|
editor.addCustom("image-paste-handler", () => new ImagePasteHandler(editor));
|
|
88452
88547
|
if (enableComments) {
|
|
88453
88548
|
editor.addCustom(
|
|
@@ -88477,7 +88572,7 @@ ${data2.flowchartText}
|
|
|
88477
88572
|
});
|
|
88478
88573
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
88479
88574
|
OnesEditorToolbar.register(editor);
|
|
88480
|
-
editor.version = "2.2.16-beta.
|
|
88575
|
+
editor.version = "2.2.16-beta.11";
|
|
88481
88576
|
return editor;
|
|
88482
88577
|
}
|
|
88483
88578
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -134242,6 +134337,7 @@ ${data2.flowchartText}
|
|
|
134242
134337
|
exports2.DocReAuthCallbacks = DocReAuthCallbacks;
|
|
134243
134338
|
exports2.DragDrop = DragDrop;
|
|
134244
134339
|
exports2.DrawioEmbed = DrawioEmbed;
|
|
134340
|
+
exports2.DrawioPasteHandler = DrawioPasteHandler;
|
|
134245
134341
|
exports2.EditorBlocks = EditorBlocks;
|
|
134246
134342
|
exports2.EditorBoxes = EditorBoxes;
|
|
134247
134343
|
exports2.EditorCommandProviders = EditorCommandProviders;
|