@ones-editor/editor 2.2.16-beta.6 → 2.2.16-beta.8
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/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/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui-base/src/toast/index.d.ts +2 -1
- package/dist/index.js +1389 -1291
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -762,7 +762,7 @@ div.comment-editor-root div.root.select-all > .container-blocks > div[data-type=
|
|
|
762
762
|
::placeholder {
|
|
763
763
|
color: #bbb;
|
|
764
764
|
}/* The snackbar - position it at the bottom and in the middle of the screen */
|
|
765
|
-
.toast {
|
|
765
|
+
.ones-editor-toast {
|
|
766
766
|
font-family: Avenir, Helvetica, Arial, sans-serif;
|
|
767
767
|
visibility: hidden; /* Hidden by default. Visible on click */
|
|
768
768
|
min-width: 250px; /* Set a default minimum width */
|
|
@@ -773,20 +773,35 @@ div.comment-editor-root div.root.select-all > .container-blocks > div[data-type=
|
|
|
773
773
|
border-radius: 2px; /* Rounded borders */
|
|
774
774
|
padding: 8px; /* Padding */
|
|
775
775
|
position: fixed; /* Sit on top of the screen */
|
|
776
|
-
z-index:
|
|
776
|
+
z-index: 12000; /* Add a z-index if needed */
|
|
777
777
|
left: 50%; /* Center the snackbar */
|
|
778
778
|
bottom: 30px; /* 30px from the bottom */
|
|
779
|
+
display: flex;
|
|
780
|
+
align-items: center;
|
|
781
|
+
justify-content: space-between;
|
|
782
|
+
font-size: 14px;
|
|
779
783
|
}
|
|
780
|
-
.toast.show {
|
|
784
|
+
.ones-editor-toast.show {
|
|
781
785
|
visibility: visible; /* Show the snackbar */
|
|
782
786
|
animation: toast_fade_in 0.5s, toast_fade_out 0.5s 2.5s;
|
|
783
787
|
}
|
|
784
|
-
.toast.positioned.show {
|
|
788
|
+
.ones-editor-toast.positioned.show {
|
|
785
789
|
animation: toast_fade_in_positioned 0.5s, toast_fade_out_positioned 0.5s 2.5s;
|
|
786
790
|
}
|
|
787
|
-
.toast.positioned {
|
|
791
|
+
.ones-editor-toast.positioned {
|
|
788
792
|
bottom: unset;
|
|
789
793
|
}
|
|
794
|
+
.ones-editor-toast > .close {
|
|
795
|
+
width: 24px;
|
|
796
|
+
height: 24px;
|
|
797
|
+
justify-content: center;
|
|
798
|
+
display: inline-flex;
|
|
799
|
+
align-items: center;
|
|
800
|
+
cursor: pointer;
|
|
801
|
+
}
|
|
802
|
+
.ones-editor-toast > .close:hover {
|
|
803
|
+
background-color: rgba(255, 255, 255, 0.1019607843);
|
|
804
|
+
}
|
|
790
805
|
@keyframes toast_fade_in {
|
|
791
806
|
from {
|
|
792
807
|
bottom: 0;
|
|
@@ -7067,6 +7082,132 @@ div.editor-root div.editor-content div[data-block-type=embed] > .embed-mask::aft
|
|
|
7067
7082
|
bottom: 0;
|
|
7068
7083
|
z-index: 999;
|
|
7069
7084
|
opacity: 0;
|
|
7085
|
+
}.ones-editor-toast[data-theme=warn] {
|
|
7086
|
+
background-color: #f59300;
|
|
7087
|
+
}
|
|
7088
|
+
.ones-editor-toast[data-theme=warn] .toast-message {
|
|
7089
|
+
display: inline-flex;
|
|
7090
|
+
align-items: center;
|
|
7091
|
+
}
|
|
7092
|
+
.ones-editor-toast[data-theme=warn] .toast-message svg {
|
|
7093
|
+
margin-right: 8px;
|
|
7094
|
+
width: 24px;
|
|
7095
|
+
height: 24px;
|
|
7096
|
+
fill: white;
|
|
7097
|
+
}
|
|
7098
|
+
.ones-editor-toast[data-theme=warn] a {
|
|
7099
|
+
margin-left: 5px;
|
|
7100
|
+
text-decoration: underline;
|
|
7101
|
+
cursor: pointer;
|
|
7102
|
+
}:root {
|
|
7103
|
+
--editor-quoted-color: #7084a4;
|
|
7104
|
+
--editor-drawio-empty-svg: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0zOC43MjAzIDI4LjcwOTdIMjUuOTIzM0MyNS4yMTY1IDI4LjcwOTcgMjQuNjQzNSAyOC4xNDgxIDI0LjY0MzUgMjcuNDU1MlYyNS43MzMzSDIwLjUyODNDMjAuNDk4NiAyNS43Njk2IDIwLjQ2NjkgMjUuODA0MiAyMC40MzMzIDI1LjgzN0wxNS45MTkyIDMwLjI2MjFWMzQuNzU1NkgyNC42NDM1VjMzLjcyNzZDMjQuNjQzNSAzMy4wMzQ4IDI1LjIxNjUgMzIuNDczMiAyNS45MjMzIDMyLjQ3MzJIMzguNzIwM0MzOS40MjcgMzIuNDczMiA0MCAzMy4wMzQ4IDQwIDMzLjcyNzZWMzguNzQ1NUM0MCAzOS40MzgzIDM5LjQyNyA0MCAzOC43MjAzIDQwSDI1LjkyMzNDMjUuMjE2NSA0MCAyNC42NDM1IDM5LjQzODMgMjQuNjQzNSAzOC43NDU1VjM3LjMzMzNIMTQuNjI2M0MxMy45MTIyIDM3LjMzMzMgMTMuMzMzMyAzNi43NTYyIDEzLjMzMzMgMzYuMDQ0NFYzMC42OTQxTDguMzc4NTIgMjUuODM3QzguMTM2MjYgMjUuNjAxNCA4IDI1LjI4MDggOCAyNC45NDYzQzggMjQuNjExOCA4LjEzNjI2IDI0LjI5MTEgOC4zNzg1MiAyNC4wNTU2TDEzLjMzMzMgMTkuMTk4NVYxNS43NzJDMTEuNzc5OCAxNS4yMjI5IDEwLjY2NjcgMTMuNzQxNiAxMC42NjY3IDEyQzEwLjY2NjcgOS43OTA4NSAxMi40NTc1IDggMTQuNjY2NyA4QzE2Ljg3NTggOCAxOC42NjY2IDkuNzkwODUgMTguNjY2NiAxMkMxOC42NjY2IDEzLjcyNjUgMTcuNTU4OCAxNS4yNTgxIDE1LjkxOTEgMTUuNzk4OFYxOS4yODg4QzE1LjkxOTEgMTkuMzkxOCAxNS45MDY4IDE5LjQ5NDMgMTUuODgyMyAxOS41OTQzTDE5LjUxNTEgMjMuMTU1NUgyNC42NDM1VjIyLjQzNzNDMjQuNjQzNSAyMS43NDQ1IDI1LjIxNjUgMjEuMTgyOSAyNS45MjMzIDIxLjE4MjlIMzguNzIwM0MzOS40MjcgMjEuMTgyOSA0MCAyMS43NDQ1IDQwIDIyLjQzNzNWMjcuNDU1MkM0MCAyOC4xNDgxIDM5LjQyNyAyOC43MDk3IDM4LjcyMDMgMjguNzA5N1pNMjcuMjAzIDM3LjQ5MUgzNy40NDA2VjM0Ljk4MjFIMjcuMjAzVjM3LjQ5MVpNMTQuNDA1OSAyOC4xOTU0TDExLjA5MTUgMjQuOTQ2M0wxNC40MDU5IDIxLjY5NzJMMTcuNzIwNCAyNC45NDYzTDE0LjQwNTkgMjguMTk1NFpNMjcuMjAzIDI2LjIwMDhIMzcuNDQwNlYyMy42OTE4SDI3LjIwM1YyNi4yMDA4WiIgZmlsbD0iIzA3MTQyQSIvPgo8L3N2Zz4K");
|
|
7105
|
+
}
|
|
7106
|
+
.flex-center, .editor-drawio-iframe-container.loading:before {
|
|
7107
|
+
display: flex;
|
|
7108
|
+
align-items: center;
|
|
7109
|
+
justify-content: center;
|
|
7110
|
+
}
|
|
7111
|
+
.full-screen, .editor-drawio-iframe-container.loading:before, .drawio-iframe-element, .editor-drawio-iframe-container {
|
|
7112
|
+
width: 100%;
|
|
7113
|
+
height: 100%;
|
|
7114
|
+
}
|
|
7115
|
+
.editor-drawio-iframe-container {
|
|
7116
|
+
position: fixed;
|
|
7117
|
+
top: 0;
|
|
7118
|
+
left: 0;
|
|
7119
|
+
z-index: 1000;
|
|
7120
|
+
}
|
|
7121
|
+
div[data-type=editor-block].embed-block[data-embed-type=drawio] > div[data-type=block-content] {
|
|
7122
|
+
outline: 1px solid #dedede;
|
|
7123
|
+
}
|
|
7124
|
+
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] {
|
|
7125
|
+
padding: 0;
|
|
7126
|
+
min-height: 200px;
|
|
7127
|
+
}
|
|
7128
|
+
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 {
|
|
7129
|
+
width: 100%;
|
|
7130
|
+
height: 100%;
|
|
7131
|
+
min-height: inherit;
|
|
7132
|
+
}
|
|
7133
|
+
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] {
|
|
7134
|
+
background-color: #fff;
|
|
7135
|
+
justify-content: center;
|
|
7136
|
+
border-radius: 3px;
|
|
7137
|
+
padding: 10px;
|
|
7138
|
+
}
|
|
7139
|
+
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 {
|
|
7140
|
+
display: flex;
|
|
7141
|
+
flex-direction: column;
|
|
7142
|
+
align-items: center;
|
|
7143
|
+
justify-content: center;
|
|
7144
|
+
}
|
|
7145
|
+
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 {
|
|
7146
|
+
width: 100%;
|
|
7147
|
+
height: 100%;
|
|
7148
|
+
background-color: #f8f8f8;
|
|
7149
|
+
display: flex;
|
|
7150
|
+
flex-direction: column;
|
|
7151
|
+
justify-content: center;
|
|
7152
|
+
text-align: center;
|
|
7153
|
+
flex: 1;
|
|
7154
|
+
}
|
|
7155
|
+
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 {
|
|
7156
|
+
width: 48px;
|
|
7157
|
+
height: 48px;
|
|
7158
|
+
}
|
|
7159
|
+
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 {
|
|
7160
|
+
font-weight: 500;
|
|
7161
|
+
font-size: 18px;
|
|
7162
|
+
line-height: 26px;
|
|
7163
|
+
text-align: center;
|
|
7164
|
+
color: #303030;
|
|
7165
|
+
margin: 23px 0 5px;
|
|
7166
|
+
}
|
|
7167
|
+
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 {
|
|
7168
|
+
font-size: 14px;
|
|
7169
|
+
line-height: 22px;
|
|
7170
|
+
text-align: center;
|
|
7171
|
+
color: #606060;
|
|
7172
|
+
}
|
|
7173
|
+
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 {
|
|
7174
|
+
cursor: pointer;
|
|
7175
|
+
margin-left: 4px;
|
|
7176
|
+
color: #0064ff;
|
|
7177
|
+
}
|
|
7178
|
+
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 {
|
|
7179
|
+
display: flex;
|
|
7180
|
+
flex-direction: column;
|
|
7181
|
+
align-items: center;
|
|
7182
|
+
}
|
|
7183
|
+
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 {
|
|
7184
|
+
font-size: 14px;
|
|
7185
|
+
line-height: 22px;
|
|
7186
|
+
text-align: center;
|
|
7187
|
+
color: #606060;
|
|
7188
|
+
margin-top: 23px;
|
|
7189
|
+
}
|
|
7190
|
+
.embed-block .editor-drawio-content.editor-embed {
|
|
7191
|
+
width: 100%;
|
|
7192
|
+
min-height: 80px;
|
|
7193
|
+
display: inline-block;
|
|
7194
|
+
text-align: center;
|
|
7195
|
+
}
|
|
7196
|
+
.embed-block .editor-drawio-content.editor-embed .editor-empty-drawio {
|
|
7197
|
+
width: 240px;
|
|
7198
|
+
height: 400px;
|
|
7199
|
+
}
|
|
7200
|
+
div.editor-root div.editor-content div[data-type=editor-container] div[data-embed-type=drawio].embed-block > div[data-type=block-content] img {
|
|
7201
|
+
max-width: 100%;
|
|
7202
|
+
max-height: 100%;
|
|
7203
|
+
}
|
|
7204
|
+
.editor-drawio-iframe-container.loading:before {
|
|
7205
|
+
content: attr(data-placeholder);
|
|
7206
|
+
position: absolute;
|
|
7207
|
+
top: 0;
|
|
7208
|
+
left: 0;
|
|
7209
|
+
background-color: #f7f6f3;
|
|
7210
|
+
z-index: 2;
|
|
7070
7211
|
}.editor-root.readonly [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-column-container.layout-column-container {
|
|
7071
7212
|
background-color: transparent;
|
|
7072
7213
|
}
|
|
@@ -7590,115 +7731,6 @@ div[data-command-bar-id=layout-column-toolbar] .tippy-box .tippy-content button.
|
|
|
7590
7731
|
}
|
|
7591
7732
|
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
7733
|
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
7734
|
}.editor-content .editing {
|
|
7703
7735
|
background-color: rgba(205, 205, 205, 0.2509803922);
|
|
7704
7736
|
}
|
|
@@ -39649,7 +39681,7 @@ ${codeText}
|
|
|
39649
39681
|
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';
|
|
39650
39682
|
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';
|
|
39651
39683
|
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';
|
|
39652
|
-
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="
|
|
39684
|
+
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';
|
|
39653
39685
|
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';
|
|
39654
39686
|
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';
|
|
39655
39687
|
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';
|
|
@@ -40845,10 +40877,11 @@ ${codeText}
|
|
|
40845
40877
|
}
|
|
40846
40878
|
}
|
|
40847
40879
|
const list = "";
|
|
40848
|
-
const toast = "";
|
|
40880
|
+
const toast$1 = "";
|
|
40849
40881
|
function showToast(text2, options) {
|
|
40882
|
+
var _a;
|
|
40850
40883
|
const toast2 = document.createElement("div");
|
|
40851
|
-
toast2.classList.add("toast", "show");
|
|
40884
|
+
toast2.classList.add("ones-editor-toast", "show");
|
|
40852
40885
|
if (options == null ? void 0 : options.theme) {
|
|
40853
40886
|
toast2.setAttribute("data-theme", options.theme);
|
|
40854
40887
|
}
|
|
@@ -40865,293 +40898,303 @@ ${codeText}
|
|
|
40865
40898
|
toast2.style.top = `${options.position.y}px`;
|
|
40866
40899
|
toast2.classList.add("positioned");
|
|
40867
40900
|
}
|
|
40868
|
-
|
|
40869
|
-
setTimeout(() => {
|
|
40901
|
+
const exit = () => {
|
|
40870
40902
|
toast2.classList.remove("show");
|
|
40871
40903
|
setTimeout(() => {
|
|
40872
40904
|
toast2.remove();
|
|
40873
40905
|
}, 500);
|
|
40874
|
-
}
|
|
40875
|
-
|
|
40876
|
-
|
|
40877
|
-
|
|
40878
|
-
|
|
40879
|
-
|
|
40880
|
-
return;
|
|
40881
|
-
}
|
|
40882
|
-
if (item.type === "section") {
|
|
40883
|
-
const nameElem = createElement("div", ["section-name"], null, item.name);
|
|
40884
|
-
elem.appendChild(nameElem);
|
|
40885
|
-
} else if (item.type === "separator")
|
|
40886
|
-
;
|
|
40887
|
-
else {
|
|
40888
|
-
if (item.icon) {
|
|
40889
|
-
const menuItemIcon = createElement("div", ["menu-item-icon"], null);
|
|
40890
|
-
if (item.icon) {
|
|
40891
|
-
menuItemIcon.innerHTML = item.icon;
|
|
40892
|
-
}
|
|
40893
|
-
elem.appendChild(menuItemIcon);
|
|
40894
|
-
}
|
|
40895
|
-
const menuItemName = createElement("div", ["menu-item-name", "text"], null);
|
|
40896
|
-
createElement("span", [], menuItemName, item.name);
|
|
40897
|
-
if (item.ellipsisTooltip) {
|
|
40898
|
-
elem.setAttribute("data-editor-tooltip-allow-markdown", "true");
|
|
40899
|
-
elem.setAttribute("data-editor-tooltip-offset-y", "25");
|
|
40900
|
-
elem.setAttribute("data-editor-tooltip-placement", "right");
|
|
40901
|
-
elem.setAttribute("data-editor-tooltip-common", `<div style="word-break: break-word;">${item.ellipsisTooltip}</div>`);
|
|
40902
|
-
}
|
|
40903
|
-
if (((_a = item.states) == null ? void 0 : _a.includes("disabled")) && item.disableReason) {
|
|
40904
|
-
elem.setAttribute("data-editor-tooltip-placement", "right");
|
|
40905
|
-
elem.setAttribute("data-editor-tooltip-common", item.disableReason);
|
|
40906
|
-
}
|
|
40907
|
-
elem.appendChild(menuItemName);
|
|
40908
|
-
if (item.subText) {
|
|
40909
|
-
createElement("div", ["item-subtext", "text"], elem, item.subText);
|
|
40910
|
-
}
|
|
40911
|
-
if (item.children && !item.element) {
|
|
40912
|
-
const subIndicator = createElement("div", ["menu-item-sub-indicator"], null);
|
|
40913
|
-
subIndicator.innerHTML = ArrowRightIcon;
|
|
40914
|
-
elem.appendChild(subIndicator);
|
|
40915
|
-
}
|
|
40916
|
-
if ((_b = item.states) == null ? void 0 : _b.includes("checked")) {
|
|
40917
|
-
const checkedIcon = createElement("div", ["menu-item-checked-icon"], null);
|
|
40918
|
-
checkedIcon.innerHTML = CheckMarkIcon;
|
|
40919
|
-
elem.appendChild(checkedIcon);
|
|
40920
|
-
}
|
|
40921
|
-
}
|
|
40922
|
-
}
|
|
40923
|
-
class ManualMenu extends ManualCommandBar {
|
|
40924
|
-
constructor(items, closeable, options) {
|
|
40925
|
-
super(items, closeable, {
|
|
40926
|
-
autoClose: true,
|
|
40927
|
-
disablePageScroll: true,
|
|
40928
|
-
beforeClose: options == null ? void 0 : options.beforeClose,
|
|
40929
|
-
...options
|
|
40930
|
-
});
|
|
40931
|
-
}
|
|
40932
|
-
manualShow(target, options) {
|
|
40933
|
-
const newOptions = {
|
|
40934
|
-
theme: "menu",
|
|
40935
|
-
...options
|
|
40936
|
-
};
|
|
40937
|
-
super.manualShow(target, newOptions);
|
|
40938
|
-
}
|
|
40939
|
-
initCommandBarElement(elem) {
|
|
40940
|
-
addClass(elem, "menu");
|
|
40941
|
-
}
|
|
40942
|
-
initItemElement(item, elem) {
|
|
40943
|
-
initMenuItem$1(item, elem);
|
|
40944
|
-
}
|
|
40945
|
-
}
|
|
40946
|
-
function createManualMenu(parentItem, closeable, options) {
|
|
40947
|
-
var _a;
|
|
40948
|
-
return new ManualMenu((_a = parentItem.children) != null ? _a : [], closeable, {
|
|
40949
|
-
...options,
|
|
40950
|
-
parentItem
|
|
40951
|
-
});
|
|
40952
|
-
}
|
|
40953
|
-
function initToolbarItem(item, elem, options) {
|
|
40954
|
-
elem.setAttribute("data-button-id", item.id);
|
|
40955
|
-
if (options.tooltipId && item.name && !item.disableTooltip) {
|
|
40956
|
-
elem.setAttribute(`data-editor-tooltip-${options.tooltipId}`, item.name);
|
|
40957
|
-
if (item.desc) {
|
|
40958
|
-
elem.setAttribute(`data-editor-tooltip-desc-${options.tooltipId}`, item.desc);
|
|
40959
|
-
}
|
|
40960
|
-
if (item.tooltipPlacement) {
|
|
40961
|
-
elem.setAttribute("data-editor-tooltip-placement", item.tooltipPlacement);
|
|
40962
|
-
}
|
|
40963
|
-
}
|
|
40964
|
-
const button2 = elem;
|
|
40965
|
-
if (!item.element) {
|
|
40966
|
-
if (item.icon && !options.showName) {
|
|
40967
|
-
const icon = createElement("span", ["toolbar-item-icon-container"], button2);
|
|
40968
|
-
if (item.icon.trim().startsWith("<")) {
|
|
40969
|
-
icon.innerHTML = item.icon;
|
|
40970
|
-
} else {
|
|
40971
|
-
icon.innerText = item.icon;
|
|
40972
|
-
}
|
|
40973
|
-
} else {
|
|
40974
|
-
const name = createElement("span", ["toolbar-item-name-container"], button2);
|
|
40975
|
-
name.innerText = item.name;
|
|
40976
|
-
}
|
|
40977
|
-
}
|
|
40978
|
-
if (item.dropdown) {
|
|
40979
|
-
elem.setAttribute("data-dropdown", "true");
|
|
40980
|
-
const dropdown2 = createElement("span", ["toolbar-item-dropdown-container"], button2);
|
|
40981
|
-
dropdown2.innerHTML = ArrowDownIcon$1;
|
|
40982
|
-
if (item.dropSplit) {
|
|
40983
|
-
addClass(button2, "toolbar-item-drop-split");
|
|
40984
|
-
if (item.splitTooltip) {
|
|
40985
|
-
elem.removeAttribute(`data-editor-tooltip-${options.tooltipId}`);
|
|
40986
|
-
dropdown2.setAttribute(`data-editor-tooltip-${options.tooltipId}`, item.splitTooltip);
|
|
40987
|
-
}
|
|
40988
|
-
}
|
|
40989
|
-
}
|
|
40990
|
-
if (item.states) {
|
|
40991
|
-
if (item.states.indexOf("checked") !== -1) {
|
|
40992
|
-
addClass(button2, "checked");
|
|
40993
|
-
}
|
|
40994
|
-
if (item.states.indexOf("disabled") !== -1) {
|
|
40995
|
-
button2.disabled = true;
|
|
40996
|
-
}
|
|
40997
|
-
}
|
|
40998
|
-
}
|
|
40999
|
-
class ManualToolbar extends ManualCommandBar {
|
|
41000
|
-
constructor(items, closeable, options) {
|
|
41001
|
-
super(items, closeable, {
|
|
41002
|
-
itemElementTag: "button",
|
|
41003
|
-
tippyArrow: false,
|
|
41004
|
-
maxWidth: clientType.isMobile ? "90vw" : "max-content",
|
|
41005
|
-
...options
|
|
41006
|
-
});
|
|
41007
|
-
}
|
|
41008
|
-
getSubBarOptions(item) {
|
|
41009
|
-
var _a, _b;
|
|
41010
|
-
const getReferenceClientRect2 = () => {
|
|
41011
|
-
const elem = this.getItemElementById(item.id);
|
|
41012
|
-
const content = this.content;
|
|
41013
|
-
const contentRect = content.getBoundingClientRect();
|
|
41014
|
-
const elemRect = elem.getBoundingClientRect();
|
|
41015
|
-
return new DOMRect(elemRect.left, contentRect.top, elemRect.width, contentRect.height);
|
|
41016
|
-
};
|
|
41017
|
-
const options = {
|
|
41018
|
-
placement: (_a = item.childrenPlacement) != null ? _a : "top",
|
|
41019
|
-
getReferenceClientRect: getReferenceClientRect2,
|
|
41020
|
-
offset: (_b = item.childrenOffset) != null ? _b : [0, 4]
|
|
41021
|
-
};
|
|
41022
|
-
return options;
|
|
41023
|
-
}
|
|
41024
|
-
manualShow(target, options) {
|
|
41025
|
-
const newOptions = {
|
|
41026
|
-
theme: "toolbar",
|
|
41027
|
-
...options
|
|
41028
|
-
};
|
|
41029
|
-
super.manualShow(target, newOptions);
|
|
41030
|
-
}
|
|
41031
|
-
initCommandBarElement(elem) {
|
|
41032
|
-
addClass(elem, "toolbar");
|
|
41033
|
-
if (clientType.isMobile) {
|
|
41034
|
-
addClass(elem, "mobile");
|
|
41035
|
-
}
|
|
41036
|
-
}
|
|
41037
|
-
initItemElement(item, elem) {
|
|
41038
|
-
initToolbarItem(item, elem, this.options);
|
|
41039
|
-
}
|
|
41040
|
-
}
|
|
41041
|
-
function createManualToolbar(parentItem, closeable, options) {
|
|
41042
|
-
var _a;
|
|
41043
|
-
return new ManualToolbar((_a = parentItem.children) != null ? _a : [], closeable, {
|
|
41044
|
-
...options,
|
|
41045
|
-
parentItem
|
|
41046
|
-
});
|
|
41047
|
-
}
|
|
41048
|
-
class FixedToolbar extends CommandBar {
|
|
41049
|
-
constructor(parent, items, options) {
|
|
41050
|
-
super(items, void 0, options);
|
|
41051
|
-
__publicField(this, "handleDocumentKeydown", (event) => {
|
|
41052
|
-
if (!this.isVisible) {
|
|
41053
|
-
return true;
|
|
41054
|
-
}
|
|
41055
|
-
if (event.isComposing) {
|
|
41056
|
-
return true;
|
|
41057
|
-
}
|
|
41058
|
-
if (this.subBar) {
|
|
41059
|
-
return this.subBar.handleDocumentKeydown(event);
|
|
41060
|
-
}
|
|
41061
|
-
return true;
|
|
41062
|
-
});
|
|
41063
|
-
__publicField(this, "getSubBarOptions", (item) => {
|
|
41064
|
-
var _a;
|
|
41065
|
-
const options = {
|
|
41066
|
-
placement: (_a = item.childrenPlacement) != null ? _a : "right-start",
|
|
41067
|
-
offset: item.childrenOffset
|
|
41068
|
-
};
|
|
41069
|
-
return options;
|
|
41070
|
-
});
|
|
41071
|
-
parent.appendChild(this.content);
|
|
41072
|
-
document.addEventListener("keydown", this.handleDocumentKeydown);
|
|
41073
|
-
if (clientType.isMobile) {
|
|
41074
|
-
document.addEventListener("touchend", this.handleDocumentMouseDown);
|
|
41075
|
-
} else {
|
|
41076
|
-
document.addEventListener("mousedown", this.handleDocumentMouseDown);
|
|
41077
|
-
}
|
|
41078
|
-
}
|
|
41079
|
-
initCommandBarElement(elem) {
|
|
41080
|
-
addClass(elem, "toolbar", "fixed");
|
|
41081
|
-
if (clientType.isMobile) {
|
|
41082
|
-
addClass(elem, "mobile");
|
|
41083
|
-
}
|
|
41084
|
-
}
|
|
41085
|
-
initItemElement(item, elem) {
|
|
41086
|
-
initToolbarItem(item, elem, this.options);
|
|
41087
|
-
}
|
|
41088
|
-
close() {
|
|
41089
|
-
this.clearSelectedItem();
|
|
41090
|
-
if (this.subBar) {
|
|
41091
|
-
this.subBar.close("cancelBar");
|
|
41092
|
-
this.subBar = null;
|
|
41093
|
-
}
|
|
41094
|
-
}
|
|
41095
|
-
destroy() {
|
|
41096
|
-
this.content.remove();
|
|
41097
|
-
super.destroy();
|
|
41098
|
-
document.removeEventListener("keydown", this.handleDocumentKeydown);
|
|
41099
|
-
document.removeEventListener("mousedown", this.handleDocumentMouseDown);
|
|
41100
|
-
document.removeEventListener("touchend", this.handleDocumentMouseDown);
|
|
41101
|
-
}
|
|
41102
|
-
getCommandBarRoot() {
|
|
41103
|
-
return this.content.parentElement;
|
|
41104
|
-
}
|
|
41105
|
-
get isVisible() {
|
|
41106
|
-
return true;
|
|
41107
|
-
}
|
|
41108
|
-
}
|
|
41109
|
-
const commandBar = "";
|
|
41110
|
-
CommandBar.registerManualCommandBar("menu", createManualMenu);
|
|
41111
|
-
CommandBar.registerManualCommandBar("toolbar", createManualToolbar);
|
|
41112
|
-
const light = "";
|
|
41113
|
-
const logger$2B = getLogger("ui-base");
|
|
41114
|
-
class ManualCloseDialog extends ManualCommandBar {
|
|
41115
|
-
constructor(content, options) {
|
|
41116
|
-
super(ManualCloseDialog.getCommandItems(content, options), void 0, {
|
|
41117
|
-
disablePageScroll: true,
|
|
41118
|
-
...options
|
|
41119
|
-
});
|
|
41120
|
-
__publicField(this, "handleDocumentMouseDown", () => {
|
|
41121
|
-
});
|
|
41122
|
-
}
|
|
41123
|
-
initCommandBarElement(elem) {
|
|
41124
|
-
addClass(elem, "dialog", "manual");
|
|
41125
|
-
}
|
|
41126
|
-
initItemElement(item, elem) {
|
|
41127
|
-
}
|
|
41128
|
-
show(target, options) {
|
|
41129
|
-
this.manualShow(target, {
|
|
41130
|
-
...options,
|
|
41131
|
-
theme: "light"
|
|
41132
|
-
});
|
|
41133
|
-
}
|
|
41134
|
-
get dialogContent() {
|
|
41135
|
-
const item = this.items[0];
|
|
41136
|
-
assert(logger$2B, item, "no dialog item");
|
|
41137
|
-
const content = item.element;
|
|
41138
|
-
assert(logger$2B, content, "no item element");
|
|
41139
|
-
return content;
|
|
40906
|
+
};
|
|
40907
|
+
const autoClose = (_a = options == null ? void 0 : options.autoClose) != null ? _a : true;
|
|
40908
|
+
if (!autoClose) {
|
|
40909
|
+
const icon = createElement("span", ["close"], toast2);
|
|
40910
|
+
icon.innerHTML = CloseIcon;
|
|
40911
|
+
icon.onclick = exit;
|
|
41140
40912
|
}
|
|
41141
|
-
|
|
41142
|
-
|
|
41143
|
-
|
|
41144
|
-
const items = [{
|
|
41145
|
-
id,
|
|
41146
|
-
name: "",
|
|
41147
|
-
element: content
|
|
41148
|
-
}];
|
|
41149
|
-
return items;
|
|
40913
|
+
document.body.appendChild(toast2);
|
|
40914
|
+
if (options == null ? void 0 : options.autoClose) {
|
|
40915
|
+
setTimeout(() => exit(), (options == null ? void 0 : options.duration) || 3e3);
|
|
41150
40916
|
}
|
|
40917
|
+
return exit;
|
|
41151
40918
|
}
|
|
41152
|
-
|
|
41153
|
-
|
|
41154
|
-
|
|
40919
|
+
function initMenuItem$1(item, elem) {
|
|
40920
|
+
var _a, _b;
|
|
40921
|
+
addClass(elem, "menu-item");
|
|
40922
|
+
if (item.element) {
|
|
40923
|
+
return;
|
|
40924
|
+
}
|
|
40925
|
+
if (item.type === "section") {
|
|
40926
|
+
const nameElem = createElement("div", ["section-name"], null, item.name);
|
|
40927
|
+
elem.appendChild(nameElem);
|
|
40928
|
+
} else if (item.type === "separator")
|
|
40929
|
+
;
|
|
40930
|
+
else {
|
|
40931
|
+
if (item.icon) {
|
|
40932
|
+
const menuItemIcon = createElement("div", ["menu-item-icon"], null);
|
|
40933
|
+
if (item.icon) {
|
|
40934
|
+
menuItemIcon.innerHTML = item.icon;
|
|
40935
|
+
}
|
|
40936
|
+
elem.appendChild(menuItemIcon);
|
|
40937
|
+
}
|
|
40938
|
+
const menuItemName = createElement("div", ["menu-item-name", "text"], null);
|
|
40939
|
+
createElement("span", [], menuItemName, item.name);
|
|
40940
|
+
if (item.ellipsisTooltip) {
|
|
40941
|
+
elem.setAttribute("data-editor-tooltip-allow-markdown", "true");
|
|
40942
|
+
elem.setAttribute("data-editor-tooltip-offset-y", "25");
|
|
40943
|
+
elem.setAttribute("data-editor-tooltip-placement", "right");
|
|
40944
|
+
elem.setAttribute("data-editor-tooltip-common", `<div style="word-break: break-word;">${item.ellipsisTooltip}</div>`);
|
|
40945
|
+
}
|
|
40946
|
+
if (((_a = item.states) == null ? void 0 : _a.includes("disabled")) && item.disableReason) {
|
|
40947
|
+
elem.setAttribute("data-editor-tooltip-placement", "right");
|
|
40948
|
+
elem.setAttribute("data-editor-tooltip-common", item.disableReason);
|
|
40949
|
+
}
|
|
40950
|
+
elem.appendChild(menuItemName);
|
|
40951
|
+
if (item.subText) {
|
|
40952
|
+
createElement("div", ["item-subtext", "text"], elem, item.subText);
|
|
40953
|
+
}
|
|
40954
|
+
if (item.children && !item.element) {
|
|
40955
|
+
const subIndicator = createElement("div", ["menu-item-sub-indicator"], null);
|
|
40956
|
+
subIndicator.innerHTML = ArrowRightIcon;
|
|
40957
|
+
elem.appendChild(subIndicator);
|
|
40958
|
+
}
|
|
40959
|
+
if ((_b = item.states) == null ? void 0 : _b.includes("checked")) {
|
|
40960
|
+
const checkedIcon = createElement("div", ["menu-item-checked-icon"], null);
|
|
40961
|
+
checkedIcon.innerHTML = CheckMarkIcon;
|
|
40962
|
+
elem.appendChild(checkedIcon);
|
|
40963
|
+
}
|
|
40964
|
+
}
|
|
40965
|
+
}
|
|
40966
|
+
class ManualMenu extends ManualCommandBar {
|
|
40967
|
+
constructor(items, closeable, options) {
|
|
40968
|
+
super(items, closeable, {
|
|
40969
|
+
autoClose: true,
|
|
40970
|
+
disablePageScroll: true,
|
|
40971
|
+
beforeClose: options == null ? void 0 : options.beforeClose,
|
|
40972
|
+
...options
|
|
40973
|
+
});
|
|
40974
|
+
}
|
|
40975
|
+
manualShow(target, options) {
|
|
40976
|
+
const newOptions = {
|
|
40977
|
+
theme: "menu",
|
|
40978
|
+
...options
|
|
40979
|
+
};
|
|
40980
|
+
super.manualShow(target, newOptions);
|
|
40981
|
+
}
|
|
40982
|
+
initCommandBarElement(elem) {
|
|
40983
|
+
addClass(elem, "menu");
|
|
40984
|
+
}
|
|
40985
|
+
initItemElement(item, elem) {
|
|
40986
|
+
initMenuItem$1(item, elem);
|
|
40987
|
+
}
|
|
40988
|
+
}
|
|
40989
|
+
function createManualMenu(parentItem, closeable, options) {
|
|
40990
|
+
var _a;
|
|
40991
|
+
return new ManualMenu((_a = parentItem.children) != null ? _a : [], closeable, {
|
|
40992
|
+
...options,
|
|
40993
|
+
parentItem
|
|
40994
|
+
});
|
|
40995
|
+
}
|
|
40996
|
+
function initToolbarItem(item, elem, options) {
|
|
40997
|
+
elem.setAttribute("data-button-id", item.id);
|
|
40998
|
+
if (options.tooltipId && item.name && !item.disableTooltip) {
|
|
40999
|
+
elem.setAttribute(`data-editor-tooltip-${options.tooltipId}`, item.name);
|
|
41000
|
+
if (item.desc) {
|
|
41001
|
+
elem.setAttribute(`data-editor-tooltip-desc-${options.tooltipId}`, item.desc);
|
|
41002
|
+
}
|
|
41003
|
+
if (item.tooltipPlacement) {
|
|
41004
|
+
elem.setAttribute("data-editor-tooltip-placement", item.tooltipPlacement);
|
|
41005
|
+
}
|
|
41006
|
+
}
|
|
41007
|
+
const button2 = elem;
|
|
41008
|
+
if (!item.element) {
|
|
41009
|
+
if (item.icon && !options.showName) {
|
|
41010
|
+
const icon = createElement("span", ["toolbar-item-icon-container"], button2);
|
|
41011
|
+
if (item.icon.trim().startsWith("<")) {
|
|
41012
|
+
icon.innerHTML = item.icon;
|
|
41013
|
+
} else {
|
|
41014
|
+
icon.innerText = item.icon;
|
|
41015
|
+
}
|
|
41016
|
+
} else {
|
|
41017
|
+
const name = createElement("span", ["toolbar-item-name-container"], button2);
|
|
41018
|
+
name.innerText = item.name;
|
|
41019
|
+
}
|
|
41020
|
+
}
|
|
41021
|
+
if (item.dropdown) {
|
|
41022
|
+
elem.setAttribute("data-dropdown", "true");
|
|
41023
|
+
const dropdown2 = createElement("span", ["toolbar-item-dropdown-container"], button2);
|
|
41024
|
+
dropdown2.innerHTML = ArrowDownIcon$1;
|
|
41025
|
+
if (item.dropSplit) {
|
|
41026
|
+
addClass(button2, "toolbar-item-drop-split");
|
|
41027
|
+
if (item.splitTooltip) {
|
|
41028
|
+
elem.removeAttribute(`data-editor-tooltip-${options.tooltipId}`);
|
|
41029
|
+
dropdown2.setAttribute(`data-editor-tooltip-${options.tooltipId}`, item.splitTooltip);
|
|
41030
|
+
}
|
|
41031
|
+
}
|
|
41032
|
+
}
|
|
41033
|
+
if (item.states) {
|
|
41034
|
+
if (item.states.indexOf("checked") !== -1) {
|
|
41035
|
+
addClass(button2, "checked");
|
|
41036
|
+
}
|
|
41037
|
+
if (item.states.indexOf("disabled") !== -1) {
|
|
41038
|
+
button2.disabled = true;
|
|
41039
|
+
}
|
|
41040
|
+
}
|
|
41041
|
+
}
|
|
41042
|
+
class ManualToolbar extends ManualCommandBar {
|
|
41043
|
+
constructor(items, closeable, options) {
|
|
41044
|
+
super(items, closeable, {
|
|
41045
|
+
itemElementTag: "button",
|
|
41046
|
+
tippyArrow: false,
|
|
41047
|
+
maxWidth: clientType.isMobile ? "90vw" : "max-content",
|
|
41048
|
+
...options
|
|
41049
|
+
});
|
|
41050
|
+
}
|
|
41051
|
+
getSubBarOptions(item) {
|
|
41052
|
+
var _a, _b;
|
|
41053
|
+
const getReferenceClientRect2 = () => {
|
|
41054
|
+
const elem = this.getItemElementById(item.id);
|
|
41055
|
+
const content = this.content;
|
|
41056
|
+
const contentRect = content.getBoundingClientRect();
|
|
41057
|
+
const elemRect = elem.getBoundingClientRect();
|
|
41058
|
+
return new DOMRect(elemRect.left, contentRect.top, elemRect.width, contentRect.height);
|
|
41059
|
+
};
|
|
41060
|
+
const options = {
|
|
41061
|
+
placement: (_a = item.childrenPlacement) != null ? _a : "top",
|
|
41062
|
+
getReferenceClientRect: getReferenceClientRect2,
|
|
41063
|
+
offset: (_b = item.childrenOffset) != null ? _b : [0, 4]
|
|
41064
|
+
};
|
|
41065
|
+
return options;
|
|
41066
|
+
}
|
|
41067
|
+
manualShow(target, options) {
|
|
41068
|
+
const newOptions = {
|
|
41069
|
+
theme: "toolbar",
|
|
41070
|
+
...options
|
|
41071
|
+
};
|
|
41072
|
+
super.manualShow(target, newOptions);
|
|
41073
|
+
}
|
|
41074
|
+
initCommandBarElement(elem) {
|
|
41075
|
+
addClass(elem, "toolbar");
|
|
41076
|
+
if (clientType.isMobile) {
|
|
41077
|
+
addClass(elem, "mobile");
|
|
41078
|
+
}
|
|
41079
|
+
}
|
|
41080
|
+
initItemElement(item, elem) {
|
|
41081
|
+
initToolbarItem(item, elem, this.options);
|
|
41082
|
+
}
|
|
41083
|
+
}
|
|
41084
|
+
function createManualToolbar(parentItem, closeable, options) {
|
|
41085
|
+
var _a;
|
|
41086
|
+
return new ManualToolbar((_a = parentItem.children) != null ? _a : [], closeable, {
|
|
41087
|
+
...options,
|
|
41088
|
+
parentItem
|
|
41089
|
+
});
|
|
41090
|
+
}
|
|
41091
|
+
class FixedToolbar extends CommandBar {
|
|
41092
|
+
constructor(parent, items, options) {
|
|
41093
|
+
super(items, void 0, options);
|
|
41094
|
+
__publicField(this, "handleDocumentKeydown", (event) => {
|
|
41095
|
+
if (!this.isVisible) {
|
|
41096
|
+
return true;
|
|
41097
|
+
}
|
|
41098
|
+
if (event.isComposing) {
|
|
41099
|
+
return true;
|
|
41100
|
+
}
|
|
41101
|
+
if (this.subBar) {
|
|
41102
|
+
return this.subBar.handleDocumentKeydown(event);
|
|
41103
|
+
}
|
|
41104
|
+
return true;
|
|
41105
|
+
});
|
|
41106
|
+
__publicField(this, "getSubBarOptions", (item) => {
|
|
41107
|
+
var _a;
|
|
41108
|
+
const options = {
|
|
41109
|
+
placement: (_a = item.childrenPlacement) != null ? _a : "right-start",
|
|
41110
|
+
offset: item.childrenOffset
|
|
41111
|
+
};
|
|
41112
|
+
return options;
|
|
41113
|
+
});
|
|
41114
|
+
parent.appendChild(this.content);
|
|
41115
|
+
document.addEventListener("keydown", this.handleDocumentKeydown);
|
|
41116
|
+
if (clientType.isMobile) {
|
|
41117
|
+
document.addEventListener("touchend", this.handleDocumentMouseDown);
|
|
41118
|
+
} else {
|
|
41119
|
+
document.addEventListener("mousedown", this.handleDocumentMouseDown);
|
|
41120
|
+
}
|
|
41121
|
+
}
|
|
41122
|
+
initCommandBarElement(elem) {
|
|
41123
|
+
addClass(elem, "toolbar", "fixed");
|
|
41124
|
+
if (clientType.isMobile) {
|
|
41125
|
+
addClass(elem, "mobile");
|
|
41126
|
+
}
|
|
41127
|
+
}
|
|
41128
|
+
initItemElement(item, elem) {
|
|
41129
|
+
initToolbarItem(item, elem, this.options);
|
|
41130
|
+
}
|
|
41131
|
+
close() {
|
|
41132
|
+
this.clearSelectedItem();
|
|
41133
|
+
if (this.subBar) {
|
|
41134
|
+
this.subBar.close("cancelBar");
|
|
41135
|
+
this.subBar = null;
|
|
41136
|
+
}
|
|
41137
|
+
}
|
|
41138
|
+
destroy() {
|
|
41139
|
+
this.content.remove();
|
|
41140
|
+
super.destroy();
|
|
41141
|
+
document.removeEventListener("keydown", this.handleDocumentKeydown);
|
|
41142
|
+
document.removeEventListener("mousedown", this.handleDocumentMouseDown);
|
|
41143
|
+
document.removeEventListener("touchend", this.handleDocumentMouseDown);
|
|
41144
|
+
}
|
|
41145
|
+
getCommandBarRoot() {
|
|
41146
|
+
return this.content.parentElement;
|
|
41147
|
+
}
|
|
41148
|
+
get isVisible() {
|
|
41149
|
+
return true;
|
|
41150
|
+
}
|
|
41151
|
+
}
|
|
41152
|
+
const commandBar = "";
|
|
41153
|
+
CommandBar.registerManualCommandBar("menu", createManualMenu);
|
|
41154
|
+
CommandBar.registerManualCommandBar("toolbar", createManualToolbar);
|
|
41155
|
+
const light = "";
|
|
41156
|
+
const logger$2B = getLogger("ui-base");
|
|
41157
|
+
class ManualCloseDialog extends ManualCommandBar {
|
|
41158
|
+
constructor(content, options) {
|
|
41159
|
+
super(ManualCloseDialog.getCommandItems(content, options), void 0, {
|
|
41160
|
+
disablePageScroll: true,
|
|
41161
|
+
...options
|
|
41162
|
+
});
|
|
41163
|
+
__publicField(this, "handleDocumentMouseDown", () => {
|
|
41164
|
+
});
|
|
41165
|
+
}
|
|
41166
|
+
initCommandBarElement(elem) {
|
|
41167
|
+
addClass(elem, "dialog", "manual");
|
|
41168
|
+
}
|
|
41169
|
+
initItemElement(item, elem) {
|
|
41170
|
+
}
|
|
41171
|
+
show(target, options) {
|
|
41172
|
+
this.manualShow(target, {
|
|
41173
|
+
...options,
|
|
41174
|
+
theme: "light"
|
|
41175
|
+
});
|
|
41176
|
+
}
|
|
41177
|
+
get dialogContent() {
|
|
41178
|
+
const item = this.items[0];
|
|
41179
|
+
assert(logger$2B, item, "no dialog item");
|
|
41180
|
+
const content = item.element;
|
|
41181
|
+
assert(logger$2B, content, "no item element");
|
|
41182
|
+
return content;
|
|
41183
|
+
}
|
|
41184
|
+
static getCommandItems(content, options) {
|
|
41185
|
+
var _a;
|
|
41186
|
+
const id = (_a = options == null ? void 0 : options.id) != null ? _a : `manual-dialog-${genId()}`;
|
|
41187
|
+
const items = [{
|
|
41188
|
+
id,
|
|
41189
|
+
name: "",
|
|
41190
|
+
element: content
|
|
41191
|
+
}];
|
|
41192
|
+
return items;
|
|
41193
|
+
}
|
|
41194
|
+
}
|
|
41195
|
+
const dropdown = "";
|
|
41196
|
+
const mobileBottomMenu$1 = "";
|
|
41197
|
+
function initMenuItem(item, elem) {
|
|
41155
41198
|
var _a, _b;
|
|
41156
41199
|
addClass(elem, "menu-item");
|
|
41157
41200
|
if (item.element) {
|
|
@@ -80533,7 +80576,7 @@ ${content}
|
|
|
80533
80576
|
"preset-1": {
|
|
80534
80577
|
name: i18n$1.t("callout.command.presetAlert"),
|
|
80535
80578
|
backgroundColor: 2,
|
|
80536
|
-
icon: WarningFilledIcon
|
|
80579
|
+
icon: WarningFilledIcon.replaceAll('fill="currentColor"', 'fill="#F59300"')
|
|
80537
80580
|
}
|
|
80538
80581
|
};
|
|
80539
80582
|
return presets[id];
|
|
@@ -81238,12 +81281,12 @@ ${content}
|
|
|
81238
81281
|
const endRect = getBlockCaretRect(this.editor, endBlock, end);
|
|
81239
81282
|
const startToolsRect = startBlock.getBoundingClientRect();
|
|
81240
81283
|
const endToolsRect = endBlock.getBoundingClientRect();
|
|
81241
|
-
const startGripperHeight =
|
|
81242
|
-
const endGripperHeight =
|
|
81284
|
+
const startGripperHeight = startRect.height + HANDLE_CIRCLE_SIZE;
|
|
81285
|
+
const endGripperHeight = endRect.height + HANDLE_CIRCLE_SIZE;
|
|
81243
81286
|
const startX = startRect.left - startToolsRect.left - startBlock.clientLeft - HANDLE_WIDTH / 2;
|
|
81244
|
-
const startY = startBlock.clientTop - HANDLE_CIRCLE_SIZE;
|
|
81287
|
+
const startY = startRect.top - startToolsRect.top - startBlock.clientTop - HANDLE_CIRCLE_SIZE;
|
|
81245
81288
|
const endX = endRect.left - endToolsRect.left - endBlock.clientLeft - HANDLE_WIDTH / 2;
|
|
81246
|
-
const endY = endBlock.clientTop;
|
|
81289
|
+
const endY = endRect.top - endToolsRect.top - endBlock.clientTop;
|
|
81247
81290
|
this.startGripper.style.left = `${startX}px`;
|
|
81248
81291
|
this.startGripper.style.top = `${startY}px`;
|
|
81249
81292
|
this.endGripper.style.left = `${endX}px`;
|
|
@@ -81921,6 +81964,906 @@ ${content}
|
|
|
81921
81964
|
this.gripper.destroy();
|
|
81922
81965
|
}
|
|
81923
81966
|
}
|
|
81967
|
+
function getContentTypeFromHeaders(headers) {
|
|
81968
|
+
const entries = Object.entries(headers);
|
|
81969
|
+
for (let i = 0; i < entries.length; i++) {
|
|
81970
|
+
const [key, value] = entries[i];
|
|
81971
|
+
if (key.toLocaleLowerCase() === "content-type") {
|
|
81972
|
+
return value;
|
|
81973
|
+
}
|
|
81974
|
+
}
|
|
81975
|
+
return "";
|
|
81976
|
+
}
|
|
81977
|
+
async function downloadImageToFile(editor, src, withCredentials = true) {
|
|
81978
|
+
try {
|
|
81979
|
+
const res = await editor.doc.request(src, {
|
|
81980
|
+
method: "get",
|
|
81981
|
+
responseType: "blob",
|
|
81982
|
+
withCredentials
|
|
81983
|
+
});
|
|
81984
|
+
const reader = new FileReader();
|
|
81985
|
+
const promise = new Promise((resolve, reject) => {
|
|
81986
|
+
reader.onload = resolve;
|
|
81987
|
+
reader.onerror = reject;
|
|
81988
|
+
});
|
|
81989
|
+
reader.readAsArrayBuffer(res.data);
|
|
81990
|
+
await promise;
|
|
81991
|
+
const buffer = reader.result;
|
|
81992
|
+
const contentType = getContentTypeFromHeaders(res.headers).toLocaleLowerCase();
|
|
81993
|
+
let ext = "";
|
|
81994
|
+
if (contentType) {
|
|
81995
|
+
const extensions = mime__default.default[contentType].extensions;
|
|
81996
|
+
if (extensions && extensions.length > 0) {
|
|
81997
|
+
ext = extensions[0];
|
|
81998
|
+
}
|
|
81999
|
+
}
|
|
82000
|
+
const file2 = new File([buffer], `${Date.now()}.${ext}`, {
|
|
82001
|
+
type: contentType
|
|
82002
|
+
});
|
|
82003
|
+
return file2;
|
|
82004
|
+
} catch (err) {
|
|
82005
|
+
return null;
|
|
82006
|
+
}
|
|
82007
|
+
}
|
|
82008
|
+
async function downloadObjectToFile(editor, url) {
|
|
82009
|
+
const file2 = await downloadImageToFile(editor, url);
|
|
82010
|
+
return file2;
|
|
82011
|
+
}
|
|
82012
|
+
async function downloadSvgToString(editor, url) {
|
|
82013
|
+
const file2 = await downloadObjectToFile(editor, url);
|
|
82014
|
+
if (!file2)
|
|
82015
|
+
return null;
|
|
82016
|
+
const text2 = await file2.text();
|
|
82017
|
+
return text2;
|
|
82018
|
+
}
|
|
82019
|
+
const isEmptyImage = (svg) => {
|
|
82020
|
+
if (svg.naturalWidth <= 1 && svg.naturalHeight <= 1) {
|
|
82021
|
+
return true;
|
|
82022
|
+
}
|
|
82023
|
+
return false;
|
|
82024
|
+
};
|
|
82025
|
+
const isEmptySvg = (svg) => {
|
|
82026
|
+
var _a, _b;
|
|
82027
|
+
const widthStr = (_a = svg.getAttribute("width")) != null ? _a : "";
|
|
82028
|
+
const heightStr = (_b = svg.getAttribute("height")) != null ? _b : "";
|
|
82029
|
+
const width = Number.parseInt(widthStr, 10);
|
|
82030
|
+
const height = Number.parseInt(heightStr, 10);
|
|
82031
|
+
if (!width || !height) {
|
|
82032
|
+
return true;
|
|
82033
|
+
}
|
|
82034
|
+
if (width <= 1 && height <= 1) {
|
|
82035
|
+
return true;
|
|
82036
|
+
}
|
|
82037
|
+
return false;
|
|
82038
|
+
};
|
|
82039
|
+
const getTextContent = (node) => node != null ? node[node.textContent === void 0 ? "text" : "textContent"] : "";
|
|
82040
|
+
function loopCheckResourceWasLoaded(options) {
|
|
82041
|
+
const { checker, maxRetryTime } = options;
|
|
82042
|
+
const startTime = Date.now();
|
|
82043
|
+
return new Promise((resolve, reject) => {
|
|
82044
|
+
function check() {
|
|
82045
|
+
try {
|
|
82046
|
+
if (checker()) {
|
|
82047
|
+
resolve();
|
|
82048
|
+
} else if (Date.now() - startTime > maxRetryTime) {
|
|
82049
|
+
reject(new Error("Max retry time exceeded"));
|
|
82050
|
+
} else {
|
|
82051
|
+
setTimeout(check, 100);
|
|
82052
|
+
}
|
|
82053
|
+
} catch (error2) {
|
|
82054
|
+
reject(error2);
|
|
82055
|
+
}
|
|
82056
|
+
}
|
|
82057
|
+
check();
|
|
82058
|
+
});
|
|
82059
|
+
}
|
|
82060
|
+
const DrawioLang = {
|
|
82061
|
+
"zh-CN": "zh",
|
|
82062
|
+
"zh-TW": "zh-tw",
|
|
82063
|
+
"ja-JP": "ja",
|
|
82064
|
+
"en-US": "en"
|
|
82065
|
+
};
|
|
82066
|
+
const drawioIframeUrl = "https://embed.diagrams.net/?embed=1";
|
|
82067
|
+
const DrawioJsUrl = "https://www.draw.io/embed.js";
|
|
82068
|
+
const PakoJsUrl = "https://cdn.jsdelivr.net/npm/pako@2.0.3/dist/pako.es5.js";
|
|
82069
|
+
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';
|
|
82070
|
+
const DEFAULT_STYLES = `
|
|
82071
|
+
<mxStylesheet>
|
|
82072
|
+
<add as="defaultVertex">
|
|
82073
|
+
<add as="shape" value="label"/>
|
|
82074
|
+
<add as="perimeter" value="rectanglePerimeter"/>
|
|
82075
|
+
<add as="fontSize" value="12"/>
|
|
82076
|
+
<add as="fontFamily" value="Helvetica"/>
|
|
82077
|
+
<add as="align" value="center"/>
|
|
82078
|
+
<add as="verticalAlign" value="middle"/>
|
|
82079
|
+
<add as="fillColor" value="#ffffff"/>
|
|
82080
|
+
<add as="strokeColor" value="#000000"/>
|
|
82081
|
+
<add as="fontColor" value="#000000"/>
|
|
82082
|
+
</add>
|
|
82083
|
+
<add as="defaultEdge">
|
|
82084
|
+
<add as="shape" value="connector"/>
|
|
82085
|
+
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
82086
|
+
<add as="endArrow" value="classic"/>
|
|
82087
|
+
<add as="fontSize" value="11"/>
|
|
82088
|
+
<add as="fontFamily" value="Helvetica"/>
|
|
82089
|
+
<add as="align" value="center"/>
|
|
82090
|
+
<add as="verticalAlign" value="middle"/>
|
|
82091
|
+
<add as="rounded" value="1"/>
|
|
82092
|
+
<add as="strokeColor" value="#000000"/>
|
|
82093
|
+
<add as="fontColor" value="#000000"/>
|
|
82094
|
+
</add>
|
|
82095
|
+
<add as="text">
|
|
82096
|
+
<add as="fillColor" value="none"/>
|
|
82097
|
+
<add as="gradientColor" value="none"/>
|
|
82098
|
+
<add as="strokeColor" value="none"/>
|
|
82099
|
+
<add as="align" value="left"/>
|
|
82100
|
+
<add as="verticalAlign" value="top"/>
|
|
82101
|
+
</add>
|
|
82102
|
+
<add as="edgeLabel" extend="text">
|
|
82103
|
+
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
82104
|
+
<add as="fontSize" value="11"/>
|
|
82105
|
+
</add>
|
|
82106
|
+
<add as="label">
|
|
82107
|
+
<add as="fontStyle" value="1"/>
|
|
82108
|
+
<add as="align" value="left"/>
|
|
82109
|
+
<add as="verticalAlign" value="middle"/>
|
|
82110
|
+
<add as="spacing" value="2"/>
|
|
82111
|
+
<add as="spacingLeft" value="52"/>
|
|
82112
|
+
<add as="imageWidth" value="42"/>
|
|
82113
|
+
<add as="imageHeight" value="42"/>
|
|
82114
|
+
<add as="rounded" value="1"/>
|
|
82115
|
+
</add>
|
|
82116
|
+
<add as="icon" extend="label">
|
|
82117
|
+
<add as="align" value="center"/>
|
|
82118
|
+
<add as="imageAlign" value="center"/>
|
|
82119
|
+
<add as="verticalLabelPosition" value="bottom"/>
|
|
82120
|
+
<add as="verticalAlign" value="top"/>
|
|
82121
|
+
<add as="spacingTop" value="4"/>
|
|
82122
|
+
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
82123
|
+
<add as="spacing" value="0"/>
|
|
82124
|
+
<add as="spacingLeft" value="0"/>
|
|
82125
|
+
<add as="spacingTop" value="6"/>
|
|
82126
|
+
<add as="fontStyle" value="0"/>
|
|
82127
|
+
<add as="imageWidth" value="48"/>
|
|
82128
|
+
<add as="imageHeight" value="48"/>
|
|
82129
|
+
</add>
|
|
82130
|
+
<add as="swimlane">
|
|
82131
|
+
<add as="shape" value="swimlane"/>
|
|
82132
|
+
<add as="fontSize" value="12"/>
|
|
82133
|
+
<add as="fontStyle" value="1"/>
|
|
82134
|
+
<add as="startSize" value="23"/>
|
|
82135
|
+
</add>
|
|
82136
|
+
<add as="group">
|
|
82137
|
+
<add as="verticalAlign" value="top"/>
|
|
82138
|
+
<add as="fillColor" value="none"/>
|
|
82139
|
+
<add as="strokeColor" value="none"/>
|
|
82140
|
+
<add as="gradientColor" value="none"/>
|
|
82141
|
+
<add as="pointerEvents" value="0"/>
|
|
82142
|
+
</add>
|
|
82143
|
+
<add as="ellipse">
|
|
82144
|
+
<add as="shape" value="ellipse"/>
|
|
82145
|
+
<add as="perimeter" value="ellipsePerimeter"/>
|
|
82146
|
+
</add>
|
|
82147
|
+
<add as="rhombus">
|
|
82148
|
+
<add as="shape" value="rhombus"/>
|
|
82149
|
+
<add as="perimeter" value="rhombusPerimeter"/>
|
|
82150
|
+
</add>
|
|
82151
|
+
<add as="triangle">
|
|
82152
|
+
<add as="shape" value="triangle"/>
|
|
82153
|
+
<add as="perimeter" value="trianglePerimeter"/>
|
|
82154
|
+
</add>
|
|
82155
|
+
<add as="line">
|
|
82156
|
+
<add as="shape" value="line"/>
|
|
82157
|
+
<add as="strokeWidth" value="4"/>
|
|
82158
|
+
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
82159
|
+
<add as="verticalAlign" value="top"/>
|
|
82160
|
+
<add as="spacingTop" value="8"/>
|
|
82161
|
+
</add>
|
|
82162
|
+
<add as="image">
|
|
82163
|
+
<add as="shape" value="image"/>
|
|
82164
|
+
<add as="labelBackgroundColor" value="white"/>
|
|
82165
|
+
<add as="verticalAlign" value="top"/>
|
|
82166
|
+
<add as="verticalLabelPosition" value="bottom"/>
|
|
82167
|
+
</add>
|
|
82168
|
+
<add as="roundImage" extend="image">
|
|
82169
|
+
<add as="perimeter" value="ellipsePerimeter"/>
|
|
82170
|
+
</add>
|
|
82171
|
+
<add as="rhombusImage" extend="image">
|
|
82172
|
+
<add as="perimeter" value="rhombusPerimeter"/>
|
|
82173
|
+
</add>
|
|
82174
|
+
<add as="arrow">
|
|
82175
|
+
<add as="shape" value="arrow"/>
|
|
82176
|
+
<add as="edgeStyle" value="none"/>
|
|
82177
|
+
<add as="fillColor" value="#ffffff"/>
|
|
82178
|
+
</add>
|
|
82179
|
+
</mxStylesheet>
|
|
82180
|
+
`;
|
|
82181
|
+
const toast = "";
|
|
82182
|
+
const showWarnToast = () => {
|
|
82183
|
+
const errorHTML = `<span class="toast-message">${WarningFilledIcon}${i18n$1.t("drawio.warnTips")}</span>`;
|
|
82184
|
+
const hide = showToast(errorHTML, {
|
|
82185
|
+
autoClose: true,
|
|
82186
|
+
position: {
|
|
82187
|
+
y: 30,
|
|
82188
|
+
x: window.innerWidth / 2
|
|
82189
|
+
},
|
|
82190
|
+
html: true,
|
|
82191
|
+
theme: "warn"
|
|
82192
|
+
});
|
|
82193
|
+
return hide;
|
|
82194
|
+
};
|
|
82195
|
+
const BORDER = 0;
|
|
82196
|
+
const SAVE_DELAY_TIME = 30 * 1e3;
|
|
82197
|
+
const DRAWIO_EMPTY_CLASS = "editor-empty-drawio";
|
|
82198
|
+
const SHOW_FULL_SCREEN_IFRAME = "show-full-screen-iframe";
|
|
82199
|
+
const logger$j = getLogger("embed-block-drawio");
|
|
82200
|
+
function getDrawioOptions(editor) {
|
|
82201
|
+
const compOptions = editor.options.componentsOptions;
|
|
82202
|
+
return compOptions.drawIO || {};
|
|
82203
|
+
}
|
|
82204
|
+
function getDrawioLang(editor) {
|
|
82205
|
+
const options = getDrawioOptions(editor);
|
|
82206
|
+
const lang = options.lang;
|
|
82207
|
+
return lang ? DrawioLang[lang] : "";
|
|
82208
|
+
}
|
|
82209
|
+
function getDrawioIframeUrl(editor) {
|
|
82210
|
+
var _a;
|
|
82211
|
+
const options = getDrawioOptions(editor) || {};
|
|
82212
|
+
const iframeUrl = ((_a = options.cdn) == null ? void 0 : _a.drawioIframe) || drawioIframeUrl;
|
|
82213
|
+
const lang = getDrawioLang(editor);
|
|
82214
|
+
return updateUrl(iframeUrl, {
|
|
82215
|
+
spin: 1,
|
|
82216
|
+
proto: "json",
|
|
82217
|
+
configure: 1,
|
|
82218
|
+
lang
|
|
82219
|
+
});
|
|
82220
|
+
}
|
|
82221
|
+
function resizeObserver(el) {
|
|
82222
|
+
const resize = () => {
|
|
82223
|
+
assert(logger$j, el, "el does not exist");
|
|
82224
|
+
const width = document.body.clientWidth || document.documentElement.clientWidth;
|
|
82225
|
+
const height = document.body.clientHeight || document.documentElement.clientHeight;
|
|
82226
|
+
el.setAttribute("width", `${width - 2 * BORDER}`);
|
|
82227
|
+
el.setAttribute("height", `${height - 2 * BORDER}`);
|
|
82228
|
+
};
|
|
82229
|
+
const disconnect = () => {
|
|
82230
|
+
window.removeEventListener("resize", resize);
|
|
82231
|
+
};
|
|
82232
|
+
resize();
|
|
82233
|
+
window.addEventListener("resize", resize);
|
|
82234
|
+
return {
|
|
82235
|
+
disconnect
|
|
82236
|
+
};
|
|
82237
|
+
}
|
|
82238
|
+
async function initializeDrawioIframe(editor, block) {
|
|
82239
|
+
const options = getDrawioOptions(editor) || {};
|
|
82240
|
+
const callbacks = options.callbacks || {};
|
|
82241
|
+
const docReAuthCallbacks = editor.getCustom(DOC_RE_AUTH_KEYS);
|
|
82242
|
+
const { onCreateDrawIoFrame, onCloseDrawIoFrame } = callbacks;
|
|
82243
|
+
let drawioIframe = null;
|
|
82244
|
+
let exit;
|
|
82245
|
+
if (onCreateDrawIoFrame) {
|
|
82246
|
+
drawioIframe = await onCreateDrawIoFrame(editor);
|
|
82247
|
+
assert(logger$j, drawioIframe, "iframe create failed");
|
|
82248
|
+
exit = () => {
|
|
82249
|
+
assert(logger$j, drawioIframe, "iframe does not exist");
|
|
82250
|
+
assert(logger$j, onCloseDrawIoFrame, "missing parameters: onCloseDrawIoFrame");
|
|
82251
|
+
docReAuthCallbacks.removeListeners();
|
|
82252
|
+
onCloseDrawIoFrame(editor, drawioIframe);
|
|
82253
|
+
};
|
|
82254
|
+
} else {
|
|
82255
|
+
const drawioContainer = createElement("div", ["editor-drawio-iframe-container", "loading"], document.body);
|
|
82256
|
+
drawioContainer.setAttribute("data-placeholder", i18n$1.t("drawio.loading"));
|
|
82257
|
+
drawioIframe = createElement("iframe", ["drawio-iframe-element"], drawioContainer);
|
|
82258
|
+
drawioIframe.setAttribute("frameborder", "0");
|
|
82259
|
+
addClass(drawioContainer, SHOW_FULL_SCREEN_IFRAME);
|
|
82260
|
+
const { disconnect } = resizeObserver(drawioIframe);
|
|
82261
|
+
exit = () => {
|
|
82262
|
+
assert(logger$j, drawioIframe, "iframe does not exist");
|
|
82263
|
+
docReAuthCallbacks.removeListeners();
|
|
82264
|
+
disconnect();
|
|
82265
|
+
document.body.removeChild(drawioContainer);
|
|
82266
|
+
removeClass(drawioContainer, SHOW_FULL_SCREEN_IFRAME);
|
|
82267
|
+
};
|
|
82268
|
+
}
|
|
82269
|
+
docReAuthCallbacks.addAuthListen("authError", () => {
|
|
82270
|
+
logger$j.debug("authError! render error toolbar");
|
|
82271
|
+
docReAuthCallbacks.reAuthToolbar.render(block, exit);
|
|
82272
|
+
});
|
|
82273
|
+
return {
|
|
82274
|
+
drawioIframe,
|
|
82275
|
+
exit
|
|
82276
|
+
};
|
|
82277
|
+
}
|
|
82278
|
+
async function saveSvgToBlock(editor, block, svg, autoSave) {
|
|
82279
|
+
var _a, _b;
|
|
82280
|
+
try {
|
|
82281
|
+
if (autoSave) {
|
|
82282
|
+
logger$j.debug("auto saving drawio data");
|
|
82283
|
+
}
|
|
82284
|
+
const regex = /(<svg [^<>]* )modified="[^&]*"([^<>]* )etag="[^&]*"/gm;
|
|
82285
|
+
const subst = "$1$2";
|
|
82286
|
+
const normalizedSvg = svg.replace(regex, subst);
|
|
82287
|
+
const blob = new Blob([normalizedSvg]);
|
|
82288
|
+
const file2 = new File([blob], "drawio.svg", {
|
|
82289
|
+
type: "image/svg+xml"
|
|
82290
|
+
});
|
|
82291
|
+
const targetBlock = editor.findBlockById(getBlockId(block));
|
|
82292
|
+
if (targetBlock) {
|
|
82293
|
+
const res = await editor.doc.uploadResource(file2);
|
|
82294
|
+
const { resourceId } = res;
|
|
82295
|
+
const oldData = editor.getBlockData(targetBlock);
|
|
82296
|
+
const oldEmbedData = oldData.embedData;
|
|
82297
|
+
const newEmbedData = {
|
|
82298
|
+
src: resourceId,
|
|
82299
|
+
height: oldEmbedData == null ? void 0 : oldEmbedData.height
|
|
82300
|
+
};
|
|
82301
|
+
editor.updateEmbedData(targetBlock, newEmbedData);
|
|
82302
|
+
} else {
|
|
82303
|
+
logger$j.error("block has been deleted");
|
|
82304
|
+
}
|
|
82305
|
+
} catch (err) {
|
|
82306
|
+
const message = `failed to save drawio data: ${err.message}`;
|
|
82307
|
+
const options = getDrawioOptions(editor);
|
|
82308
|
+
if ((_a = options.callbacks) == null ? void 0 : _a.onError) {
|
|
82309
|
+
const newError = new Error(message);
|
|
82310
|
+
newError.code = "SaveDrawIo";
|
|
82311
|
+
(_b = options.callbacks) == null ? void 0 : _b.onError(editor, newError);
|
|
82312
|
+
}
|
|
82313
|
+
throw err;
|
|
82314
|
+
}
|
|
82315
|
+
}
|
|
82316
|
+
class LoadingHandler {
|
|
82317
|
+
constructor() {
|
|
82318
|
+
__publicField(this, "loadingContainer");
|
|
82319
|
+
__publicField(this, "setLoading", (iframe, placeholder2 = i18n$1.t("drawio.save")) => {
|
|
82320
|
+
const parent = iframe.parentElement;
|
|
82321
|
+
if (parent) {
|
|
82322
|
+
addClass(parent, "loading");
|
|
82323
|
+
parent.setAttribute("data-placeholder", placeholder2);
|
|
82324
|
+
}
|
|
82325
|
+
});
|
|
82326
|
+
__publicField(this, "removeLoading", () => {
|
|
82327
|
+
const containers = document.querySelectorAll(".editor-drawio-iframe-container");
|
|
82328
|
+
containers.forEach((r) => {
|
|
82329
|
+
removeClass(r, "loading");
|
|
82330
|
+
});
|
|
82331
|
+
});
|
|
82332
|
+
}
|
|
82333
|
+
}
|
|
82334
|
+
function contactWithIframe(editor, block, drawIoData, iframe, loaded, exit, isInitializationCompleted2) {
|
|
82335
|
+
const destroy = () => {
|
|
82336
|
+
window.removeEventListener("message", receive);
|
|
82337
|
+
exit();
|
|
82338
|
+
};
|
|
82339
|
+
const loadingHandler = new LoadingHandler();
|
|
82340
|
+
loadingHandler.setLoading(iframe, i18n$1.t("drawio.loading"));
|
|
82341
|
+
let exportFlag = "auto";
|
|
82342
|
+
const receive = async (evt) => {
|
|
82343
|
+
var _a, _b;
|
|
82344
|
+
assert(logger$j, iframe.contentWindow, "iframe.contentWindow does not exist");
|
|
82345
|
+
if (evt.data.length > 0) {
|
|
82346
|
+
const msg = JSON.parse(evt.data);
|
|
82347
|
+
const xml = drawIoData.xmlSvg || drawIoData.xml;
|
|
82348
|
+
assert(logger$j, xml, "xml does not exist");
|
|
82349
|
+
switch (msg.event) {
|
|
82350
|
+
case "configure":
|
|
82351
|
+
iframe.contentWindow.postMessage(JSON.stringify({
|
|
82352
|
+
action: "configure",
|
|
82353
|
+
config: {
|
|
82354
|
+
defaultFonts: ["Humor Sans", "Helvetica", "Times New Roman"]
|
|
82355
|
+
}
|
|
82356
|
+
}), "*");
|
|
82357
|
+
break;
|
|
82358
|
+
case "init":
|
|
82359
|
+
iframe.contentWindow.postMessage(JSON.stringify({
|
|
82360
|
+
action: "load",
|
|
82361
|
+
saveAndExit: 1,
|
|
82362
|
+
noSaveBtn: 1,
|
|
82363
|
+
noExitBtn: 0,
|
|
82364
|
+
xml
|
|
82365
|
+
}), "*");
|
|
82366
|
+
loaded();
|
|
82367
|
+
loadingHandler.removeLoading();
|
|
82368
|
+
break;
|
|
82369
|
+
case "save":
|
|
82370
|
+
exportFlag = "save";
|
|
82371
|
+
iframe.contentWindow.postMessage(JSON.stringify({
|
|
82372
|
+
action: "export",
|
|
82373
|
+
format: "xmlsvg",
|
|
82374
|
+
spin: "Saving graph"
|
|
82375
|
+
}), "*");
|
|
82376
|
+
break;
|
|
82377
|
+
case "export":
|
|
82378
|
+
if (exportFlag !== "auto") {
|
|
82379
|
+
loadingHandler.setLoading(iframe);
|
|
82380
|
+
}
|
|
82381
|
+
const svg = fromBase64(msg.data.substring(msg.data.indexOf(",") + 1));
|
|
82382
|
+
try {
|
|
82383
|
+
await saveSvgToBlock(editor, block, svg, !!((_a = msg.message) == null ? void 0 : _a.autoSave));
|
|
82384
|
+
if (!((_b = msg.message) == null ? void 0 : _b.autoSave)) {
|
|
82385
|
+
destroy();
|
|
82386
|
+
}
|
|
82387
|
+
} catch (error2) {
|
|
82388
|
+
const docReAuthCallbacks = editor.getCustom(DOC_RE_AUTH_KEYS);
|
|
82389
|
+
docReAuthCallbacks.emit("tokenExpired");
|
|
82390
|
+
if (exportFlag === "save") {
|
|
82391
|
+
docReAuthCallbacks.reAuthToolbar.render(block, exit);
|
|
82392
|
+
}
|
|
82393
|
+
}
|
|
82394
|
+
loadingHandler.removeLoading();
|
|
82395
|
+
exportFlag = "auto";
|
|
82396
|
+
break;
|
|
82397
|
+
case "exit":
|
|
82398
|
+
exportFlag = "exit";
|
|
82399
|
+
destroy();
|
|
82400
|
+
break;
|
|
82401
|
+
}
|
|
82402
|
+
}
|
|
82403
|
+
};
|
|
82404
|
+
window.addEventListener("message", receive);
|
|
82405
|
+
}
|
|
82406
|
+
async function editGraph(editor, block, data2, isInitializationCompleted2) {
|
|
82407
|
+
if (isInitializationCompleted2) {
|
|
82408
|
+
return;
|
|
82409
|
+
}
|
|
82410
|
+
isInitializationCompleted2 = true;
|
|
82411
|
+
const options = getDrawioOptions(editor) || {};
|
|
82412
|
+
const { callbacks } = options;
|
|
82413
|
+
let autoSaveInterval;
|
|
82414
|
+
if (callbacks && (callbacks == null ? void 0 : callbacks.onBeginInitDrawIo)) {
|
|
82415
|
+
callbacks.onBeginInitDrawIo(editor, block);
|
|
82416
|
+
}
|
|
82417
|
+
if (data2.src) {
|
|
82418
|
+
const svg = await downloadSvgToString(editor, editor.doc.buildResourceUrl(data2.src));
|
|
82419
|
+
if (svg) {
|
|
82420
|
+
data2.xmlSvg = svg;
|
|
82421
|
+
}
|
|
82422
|
+
}
|
|
82423
|
+
if (!data2.xml && !data2.xmlSvg) {
|
|
82424
|
+
showWarnToast();
|
|
82425
|
+
return;
|
|
82426
|
+
}
|
|
82427
|
+
const { drawioIframe, exit: exitIframe } = await initializeDrawioIframe(editor, block);
|
|
82428
|
+
exclusiveBlock(editor, block);
|
|
82429
|
+
const loaded = () => {
|
|
82430
|
+
autoSaveInterval = setInterval(() => {
|
|
82431
|
+
if (!drawioIframe || !drawioIframe.contentWindow) {
|
|
82432
|
+
return;
|
|
82433
|
+
}
|
|
82434
|
+
drawioIframe.contentWindow.postMessage(JSON.stringify({
|
|
82435
|
+
action: "export",
|
|
82436
|
+
format: "xmlsvg",
|
|
82437
|
+
spin: "Saving graph",
|
|
82438
|
+
autoSave: true
|
|
82439
|
+
}), "*");
|
|
82440
|
+
}, SAVE_DELAY_TIME);
|
|
82441
|
+
};
|
|
82442
|
+
const exit = () => {
|
|
82443
|
+
exitIframe();
|
|
82444
|
+
if (autoSaveInterval) {
|
|
82445
|
+
clearInterval(autoSaveInterval);
|
|
82446
|
+
}
|
|
82447
|
+
const newBlock = editor.findBlockById(getBlockId(block));
|
|
82448
|
+
if (newBlock) {
|
|
82449
|
+
unexclusiveBlock(editor, newBlock);
|
|
82450
|
+
}
|
|
82451
|
+
};
|
|
82452
|
+
contactWithIframe(editor, block, data2, drawioIframe, loaded, exit);
|
|
82453
|
+
const iframeUrl = getDrawioIframeUrl(editor);
|
|
82454
|
+
drawioIframe.setAttribute("src", iframeUrl);
|
|
82455
|
+
}
|
|
82456
|
+
async function initDrawIo(editor) {
|
|
82457
|
+
var _a, _b;
|
|
82458
|
+
const option = getDrawioOptions(editor);
|
|
82459
|
+
const drawIoUrl = ((_a = option.cdn) == null ? void 0 : _a.drawio) || DrawioJsUrl;
|
|
82460
|
+
const pakoUrl = ((_b = option.cdn) == null ? void 0 : _b.pako) || PakoJsUrl;
|
|
82461
|
+
await loadJsPromise(pakoUrl, "editor-pako");
|
|
82462
|
+
await loadJsPromise(drawIoUrl, "editor-drawio");
|
|
82463
|
+
}
|
|
82464
|
+
function removeDrawioEmptyStatus(embed) {
|
|
82465
|
+
removeClass(embed, DRAWIO_EMPTY_CLASS);
|
|
82466
|
+
}
|
|
82467
|
+
function addDrawioEmptyStatus(embed) {
|
|
82468
|
+
addClass(embed, DRAWIO_EMPTY_CLASS);
|
|
82469
|
+
const emptyContent = createElement("div", ["drawio-empty-content"], embed);
|
|
82470
|
+
emptyContent.innerHTML = EmptyIcon;
|
|
82471
|
+
createElement("span", ["drawio-empty-title"], emptyContent, i18n$1.t("drawio.empty"));
|
|
82472
|
+
}
|
|
82473
|
+
function addDrawioLoadErrorStatus(editor, embed, data2) {
|
|
82474
|
+
const block = getParentBlock(embed);
|
|
82475
|
+
if (!block) {
|
|
82476
|
+
return;
|
|
82477
|
+
}
|
|
82478
|
+
const blockContent = getBlockContent(block);
|
|
82479
|
+
embed.innerHTML = "";
|
|
82480
|
+
embed.style.height = "100%";
|
|
82481
|
+
addClass(block, "drawio-load-error");
|
|
82482
|
+
const errorContent = createElement("div", ["drawio-error-content"], embed);
|
|
82483
|
+
const brandIcon = createElement("div", ["drawio-error-brand-icon"], errorContent);
|
|
82484
|
+
brandIcon.innerHTML = UmlBrandIcon;
|
|
82485
|
+
createElement("div", ["drawio-error-title"], errorContent, i18n$1.t("drawio.errorTips"));
|
|
82486
|
+
const subTitle = createElement("div", ["drawio-error-sub-title"], errorContent);
|
|
82487
|
+
createElement("span", [], subTitle, i18n$1.t("drawio.errorSubTips"));
|
|
82488
|
+
const retryButton = createElement("span", ["drawio-error-retry-button"], subTitle, i18n$1.t("drawio.retry"));
|
|
82489
|
+
retryButton.onclick = () => {
|
|
82490
|
+
embed.innerHTML = "";
|
|
82491
|
+
removeClass(block, "drawio-load-error");
|
|
82492
|
+
if (data2.src) {
|
|
82493
|
+
updateGraphBySrc(data2.src, embed, editor);
|
|
82494
|
+
} else if (data2.xml) {
|
|
82495
|
+
updateGraphByXml(data2.xml, embed, editor);
|
|
82496
|
+
} else if (data2.xmlSvg) {
|
|
82497
|
+
updateGraphByXmlSvg(data2.xmlSvg, embed);
|
|
82498
|
+
}
|
|
82499
|
+
if (data2.height) {
|
|
82500
|
+
blockContent.style.height = `${data2.height}px`;
|
|
82501
|
+
embed.style.height = `${data2.height - 20}px`;
|
|
82502
|
+
}
|
|
82503
|
+
};
|
|
82504
|
+
}
|
|
82505
|
+
function setGraph(embed, data2) {
|
|
82506
|
+
assert(logger$j, data2, "Required data is missing in setGraph");
|
|
82507
|
+
if ("src" in data2) {
|
|
82508
|
+
embed.setAttribute("data-src", data2.src);
|
|
82509
|
+
return;
|
|
82510
|
+
}
|
|
82511
|
+
if ("xmlSvg" in data2) {
|
|
82512
|
+
embed.setAttribute("data-xmlsvg", data2.xmlSvg);
|
|
82513
|
+
return;
|
|
82514
|
+
}
|
|
82515
|
+
if ("graph" in data2) {
|
|
82516
|
+
const { xml, graph: graph2 } = data2;
|
|
82517
|
+
embed.graph = graph2;
|
|
82518
|
+
embed.setAttribute("data-mxfile", xml);
|
|
82519
|
+
}
|
|
82520
|
+
}
|
|
82521
|
+
function getPreGraphData(embed) {
|
|
82522
|
+
return {
|
|
82523
|
+
src: embed.getAttribute("data-src") || "",
|
|
82524
|
+
xmlSvg: embed.getAttribute("data-xmlsvg") || "",
|
|
82525
|
+
xml: embed.getAttribute("data-mxfile") || ""
|
|
82526
|
+
};
|
|
82527
|
+
}
|
|
82528
|
+
function updateGraphBySrc(src, embed, editor) {
|
|
82529
|
+
assert(logger$j, src, "params error: src");
|
|
82530
|
+
assert(logger$j, editor, "params error: editor");
|
|
82531
|
+
const embedEl = embed;
|
|
82532
|
+
const url = editor.doc.buildResourceUrl(src, {
|
|
82533
|
+
syncNewResources: async (resourceId, resourceUrl) => {
|
|
82534
|
+
var _a, _b;
|
|
82535
|
+
await editor.doc.addResources([resourceId]);
|
|
82536
|
+
const serviceAppId = (_b = (_a = editor.doc).getServerMeta) == null ? void 0 : _b.call(_a).appId;
|
|
82537
|
+
if (resourceUrl !== src && serviceAppId && src.includes(serviceAppId)) {
|
|
82538
|
+
const block = getParentBlock(embed);
|
|
82539
|
+
if (block && !editor.readonly && editor.isBlockWritable(block)) {
|
|
82540
|
+
const newBlockData = cloneDeep__default.default(editor.getBlockData(block));
|
|
82541
|
+
newBlockData.embedData.src = resourceId;
|
|
82542
|
+
editor.updateBlockData(block, newBlockData);
|
|
82543
|
+
}
|
|
82544
|
+
}
|
|
82545
|
+
}
|
|
82546
|
+
});
|
|
82547
|
+
const img = document.createElement("img");
|
|
82548
|
+
embedEl.innerHTML = "";
|
|
82549
|
+
embedEl.appendChild(img);
|
|
82550
|
+
img.src = url;
|
|
82551
|
+
img.draggable = false;
|
|
82552
|
+
setGraph(embedEl, { src });
|
|
82553
|
+
img.onload = (e2) => {
|
|
82554
|
+
const img2 = embedEl.querySelector("img");
|
|
82555
|
+
if (e2.target !== img2 || !img2) {
|
|
82556
|
+
return;
|
|
82557
|
+
}
|
|
82558
|
+
if (isEmptyImage(img2)) {
|
|
82559
|
+
addDrawioEmptyStatus(embed);
|
|
82560
|
+
} else {
|
|
82561
|
+
removeDrawioEmptyStatus(embed);
|
|
82562
|
+
}
|
|
82563
|
+
};
|
|
82564
|
+
img.onerror = (e2) => {
|
|
82565
|
+
const img2 = embedEl.querySelector("img");
|
|
82566
|
+
if (e2.target !== img2) {
|
|
82567
|
+
return;
|
|
82568
|
+
}
|
|
82569
|
+
addDrawioLoadErrorStatus(editor, embed, {
|
|
82570
|
+
src
|
|
82571
|
+
});
|
|
82572
|
+
};
|
|
82573
|
+
}
|
|
82574
|
+
function updateGraphByXml(mxFile, embed, editor) {
|
|
82575
|
+
assert(logger$j, editor, "parameter missing");
|
|
82576
|
+
initDrawIo(editor).then(() => loopCheckResourceWasLoaded({
|
|
82577
|
+
checker: () => !!(window.mxUtils && window.mxGraph && window.mxCodec),
|
|
82578
|
+
maxRetryTime: 5e3
|
|
82579
|
+
})).then(() => {
|
|
82580
|
+
const { mxUtils, mxGraph: MxGraph, mxCodec: MxCodec } = window;
|
|
82581
|
+
assert(logger$j, mxUtils, "External resource loading exception: mxUtils");
|
|
82582
|
+
assert(logger$j, MxGraph, "External resource loading exception: MxGraph");
|
|
82583
|
+
assert(logger$j, MxCodec, "External resource loading exception: MxCodec");
|
|
82584
|
+
const file2 = mxUtils.parseXml(mxFile);
|
|
82585
|
+
embed.innerHTML = "";
|
|
82586
|
+
const node = file2.documentElement;
|
|
82587
|
+
assert(logger$j, node, "Resource parsing exception");
|
|
82588
|
+
assert(logger$j, node.nodeName === "mxfile", "Resource parsing exception");
|
|
82589
|
+
const diagrams = node.getElementsByTagName("diagram");
|
|
82590
|
+
assert(logger$j, diagrams.length > 0, "Resource parsing exception");
|
|
82591
|
+
let xmlDoc;
|
|
82592
|
+
const data2 = diagrams[0];
|
|
82593
|
+
if (data2.text || data2.textContent.trim()) {
|
|
82594
|
+
const diagramBase64 = getTextContent(data2);
|
|
82595
|
+
const raw = atob(diagramBase64);
|
|
82596
|
+
const pako = window.pako;
|
|
82597
|
+
assert(logger$j, pako, "External resource loading exception: pako");
|
|
82598
|
+
const encodedXml = pako.inflateRaw(Uint8Array.from(raw, (c) => c.charCodeAt(0)), { to: "string" });
|
|
82599
|
+
const xml = decodeURIComponent(encodedXml);
|
|
82600
|
+
xmlDoc = mxUtils.parseXml(xml);
|
|
82601
|
+
} else {
|
|
82602
|
+
const xml = new XMLSerializer().serializeToString(data2.firstElementChild);
|
|
82603
|
+
xmlDoc = mxUtils.parseXml(xml);
|
|
82604
|
+
}
|
|
82605
|
+
const graph2 = new MxGraph(embed);
|
|
82606
|
+
graph2.resetViewOnRootChange = false;
|
|
82607
|
+
graph2.foldingEnabled = false;
|
|
82608
|
+
graph2.setTooltips(false);
|
|
82609
|
+
graph2.setEnabled(false);
|
|
82610
|
+
graph2.setHtmlLabels(true);
|
|
82611
|
+
const styleDoc = mxUtils.parseXml(DEFAULT_STYLES);
|
|
82612
|
+
const dec = new MxCodec(styleDoc);
|
|
82613
|
+
dec.decode(styleDoc.documentElement, graph2.getStylesheet());
|
|
82614
|
+
const codec = new MxCodec(xmlDoc);
|
|
82615
|
+
codec.decode(codec.document.documentElement, graph2.getModel());
|
|
82616
|
+
graph2.maxFitScale = 1;
|
|
82617
|
+
graph2.fit();
|
|
82618
|
+
graph2.center(true, false);
|
|
82619
|
+
setGraph(embed, { graph: graph2, xml: mxFile });
|
|
82620
|
+
}).catch((err) => {
|
|
82621
|
+
logger$j.error("Failed to Init DrawIo", err);
|
|
82622
|
+
});
|
|
82623
|
+
}
|
|
82624
|
+
function updateGraphByXmlSvg(xmlSvg, embed) {
|
|
82625
|
+
embed.innerHTML = xmlSvg;
|
|
82626
|
+
setGraph(embed, { xmlSvg });
|
|
82627
|
+
const svgElements = embed.querySelectorAll("svg");
|
|
82628
|
+
for (let i = 0; i < svgElements.length; i++) {
|
|
82629
|
+
const svg = svgElements[i];
|
|
82630
|
+
if (!isEmptySvg(svg)) {
|
|
82631
|
+
return;
|
|
82632
|
+
}
|
|
82633
|
+
}
|
|
82634
|
+
addDrawioEmptyStatus(embed);
|
|
82635
|
+
}
|
|
82636
|
+
function getBlockProperties$5(editor, block) {
|
|
82637
|
+
const properties = getStandardEmbedBlockProperties(editor, block, {
|
|
82638
|
+
handleExecuteCommand: (editor2, block2, item) => {
|
|
82639
|
+
if (item.id === "edit") {
|
|
82640
|
+
const data2 = editor2.getBlockData(block2).embedData;
|
|
82641
|
+
editGraph(editor2, block2, data2, false);
|
|
82642
|
+
return true;
|
|
82643
|
+
}
|
|
82644
|
+
if (item.id === "download") {
|
|
82645
|
+
const image = block2.querySelector(".editor-drawio-content img");
|
|
82646
|
+
if (!(image instanceof HTMLImageElement))
|
|
82647
|
+
return true;
|
|
82648
|
+
downloadImageAsPng(image.src);
|
|
82649
|
+
return true;
|
|
82650
|
+
}
|
|
82651
|
+
return false;
|
|
82652
|
+
},
|
|
82653
|
+
extCommands: (editor2, block2) => {
|
|
82654
|
+
const blockContent = getBlockContent(block2);
|
|
82655
|
+
const drawioImg = blockContent.querySelector(".editor-drawio-content img");
|
|
82656
|
+
return [{
|
|
82657
|
+
id: "download",
|
|
82658
|
+
name: i18n$1.t("common.downloadAsImage"),
|
|
82659
|
+
icon: DownloadIcon$1,
|
|
82660
|
+
states: !drawioImg ? ["disabled"] : []
|
|
82661
|
+
}];
|
|
82662
|
+
},
|
|
82663
|
+
presetIds: ["edit"],
|
|
82664
|
+
extIds: ["separator"]
|
|
82665
|
+
});
|
|
82666
|
+
return { ...properties, abstract: i18n$1.t("drawio.abstract") };
|
|
82667
|
+
}
|
|
82668
|
+
const enUS$6 = {
|
|
82669
|
+
drawio: {
|
|
82670
|
+
title: "Flowchart/UML",
|
|
82671
|
+
empty: "Empty graph",
|
|
82672
|
+
loading: "Loading",
|
|
82673
|
+
abstract: "Flowchart/UML",
|
|
82674
|
+
errorTips: "Flowchart/UML loading failed",
|
|
82675
|
+
errorSubTips: "The network service is abnormal, you can",
|
|
82676
|
+
warnTips: "\u6D41\u7A0B\u56FE/UML \u8D44\u6E90\u83B7\u53D6\u5931\u8D25\uFF0C\u65E0\u6CD5\u8FDB\u884C\u7F16\u8F91\u3002",
|
|
82677
|
+
retry: "Try again",
|
|
82678
|
+
save: "Saving"
|
|
82679
|
+
}
|
|
82680
|
+
};
|
|
82681
|
+
const zhCN$6 = {
|
|
82682
|
+
drawio: {
|
|
82683
|
+
title: "\u6D41\u7A0B\u56FE/UML",
|
|
82684
|
+
empty: "\u7A7A\u56FE\u8868",
|
|
82685
|
+
loading: "\u52A0\u8F7D\u4E2D",
|
|
82686
|
+
abstract: "\u6D41\u7A0B\u56FE/UML",
|
|
82687
|
+
errorTips: "\u6D41\u7A0B\u56FE/UML\u52A0\u8F7D\u5931\u8D25",
|
|
82688
|
+
errorSubTips: "\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5",
|
|
82689
|
+
warnTips: "\u6D41\u7A0B\u56FE/UML \u8D44\u6E90\u83B7\u53D6\u5931\u8D25\uFF0C\u65E0\u6CD5\u8FDB\u884C\u7F16\u8F91\u3002",
|
|
82690
|
+
retry: "\u91CD\u8BD5",
|
|
82691
|
+
save: "\u4FDD\u5B58\u4E2D"
|
|
82692
|
+
}
|
|
82693
|
+
};
|
|
82694
|
+
const jaJP$6 = {
|
|
82695
|
+
drawio: {
|
|
82696
|
+
title: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",
|
|
82697
|
+
empty: "\u30B0\u30E9\u30D5\u30C7\u30FC\u30BF\u306A\u3057",
|
|
82698
|
+
loading: "\u8AAD\u8FBC\u4E2D",
|
|
82699
|
+
abstract: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",
|
|
82700
|
+
errorTips: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML \u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
82701
|
+
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 ",
|
|
82702
|
+
warnTips: "\u6D41\u7A0B\u56FE/UML \u8D44\u6E90\u83B7\u53D6\u5931\u8D25\uFF0C\u65E0\u6CD5\u8FDB\u884C\u7F16\u8F91\u3002",
|
|
82703
|
+
retry: "\u518D\u8A66\u884C",
|
|
82704
|
+
save: "\u4FDD\u5B58\u4E2D"
|
|
82705
|
+
}
|
|
82706
|
+
};
|
|
82707
|
+
const langs = {
|
|
82708
|
+
"en-US": enUS$6,
|
|
82709
|
+
"zh-CN": zhCN$6,
|
|
82710
|
+
"ja-JP": jaJP$6
|
|
82711
|
+
};
|
|
82712
|
+
i18n$1.mergeLang(langs);
|
|
82713
|
+
const logger$i = getLogger("embed-block-drawio");
|
|
82714
|
+
const isInitializationCompleted = false;
|
|
82715
|
+
function editDrawIO(editor, block, embed, data2) {
|
|
82716
|
+
assert(logger$i, embed, `parameter missing: ${embed}`);
|
|
82717
|
+
assert(logger$i, editor, `parameter missing: ${editor}`);
|
|
82718
|
+
editGraph(editor, block, data2, isInitializationCompleted);
|
|
82719
|
+
}
|
|
82720
|
+
function updateViewLayer(editor, embed, data2) {
|
|
82721
|
+
const { src, xml, xmlSvg } = data2;
|
|
82722
|
+
if (src) {
|
|
82723
|
+
updateGraphBySrc(src, embed, editor);
|
|
82724
|
+
} else if (xml) {
|
|
82725
|
+
updateGraphByXml(xml, embed, editor);
|
|
82726
|
+
} else if (xmlSvg) {
|
|
82727
|
+
updateGraphByXmlSvg(xmlSvg, embed);
|
|
82728
|
+
} else {
|
|
82729
|
+
addDrawioEmptyStatus(embed);
|
|
82730
|
+
}
|
|
82731
|
+
}
|
|
82732
|
+
function mount(editor, content, data2) {
|
|
82733
|
+
const embed = createElement("div", ["editor-drawio-content", "editor-embed"], null);
|
|
82734
|
+
content.appendChild(embed);
|
|
82735
|
+
updateViewLayer(editor, embed, data2);
|
|
82736
|
+
if (data2.height) {
|
|
82737
|
+
content.style.height = `${data2.height}px`;
|
|
82738
|
+
embed.style.height = `${data2.height - 20}px`;
|
|
82739
|
+
}
|
|
82740
|
+
}
|
|
82741
|
+
function update$1(editor, embed, data2) {
|
|
82742
|
+
const { src, xml, xmlSvg } = data2;
|
|
82743
|
+
const preDrawioData = getPreGraphData(embed);
|
|
82744
|
+
if (src !== preDrawioData.src || (xml || "") !== preDrawioData.xml || (xmlSvg || "") !== preDrawioData.xmlSvg) {
|
|
82745
|
+
updateViewLayer(editor, embed, data2);
|
|
82746
|
+
return;
|
|
82747
|
+
}
|
|
82748
|
+
const content = embed.parentElement;
|
|
82749
|
+
const block = getParentBlock(content);
|
|
82750
|
+
if (data2.height && data2.height !== Number.parseInt(content.style.height, 10)) {
|
|
82751
|
+
content.style.height = `${data2.height}px`;
|
|
82752
|
+
if (block && !block.classList.contains("drawio-load-error")) {
|
|
82753
|
+
embed.style.height = `${data2.height - 20}px`;
|
|
82754
|
+
} else {
|
|
82755
|
+
embed.style.height = "100%";
|
|
82756
|
+
}
|
|
82757
|
+
}
|
|
82758
|
+
}
|
|
82759
|
+
function createEmbedContent$5(editor, content, blockData, path, container, block) {
|
|
82760
|
+
const drawioData = blockData.embedData;
|
|
82761
|
+
mount(editor, content, drawioData);
|
|
82762
|
+
if (!clientType.isMobile) {
|
|
82763
|
+
EmbedBlockResizer.register(editor, block);
|
|
82764
|
+
}
|
|
82765
|
+
}
|
|
82766
|
+
function handleUpdateBlock$4(editor, block, blockData) {
|
|
82767
|
+
const data2 = blockData.embedData;
|
|
82768
|
+
const content = getBlockContent(block);
|
|
82769
|
+
const embed = content.querySelector(":scope > .editor-drawio-content");
|
|
82770
|
+
assert(logger$i, embed, "embed should not be null");
|
|
82771
|
+
update$1(editor, embed, data2);
|
|
82772
|
+
return true;
|
|
82773
|
+
}
|
|
82774
|
+
function getOptions$3() {
|
|
82775
|
+
return {
|
|
82776
|
+
name: "UML",
|
|
82777
|
+
insertEmbedCommandItems: [{
|
|
82778
|
+
id: "insert-drawio",
|
|
82779
|
+
name: i18n$1.t("drawio.title"),
|
|
82780
|
+
icon: UmlIcon,
|
|
82781
|
+
group: "common",
|
|
82782
|
+
order: 600,
|
|
82783
|
+
subText: getShortcutById("insert-drawio")
|
|
82784
|
+
}],
|
|
82785
|
+
handleInsertEmptyEmbed: async (editor, options) => {
|
|
82786
|
+
const embedData = {
|
|
82787
|
+
src: "",
|
|
82788
|
+
xml: "",
|
|
82789
|
+
xmlSvg: ""
|
|
82790
|
+
};
|
|
82791
|
+
const block = editor.insertEmbed(options.containerId, options.blockIndex, "drawio", embedData);
|
|
82792
|
+
setTimeout(() => {
|
|
82793
|
+
const blockContent = getBlockContent(block);
|
|
82794
|
+
const embed = blockContent.querySelector(":scope > .editor-drawio-content");
|
|
82795
|
+
assert(logger$i, embed, "embed should not be null");
|
|
82796
|
+
const blockData = editor.getBlockData(block);
|
|
82797
|
+
editDrawIO(editor, block, embed, blockData.embedData);
|
|
82798
|
+
}, 100);
|
|
82799
|
+
return block;
|
|
82800
|
+
}
|
|
82801
|
+
};
|
|
82802
|
+
}
|
|
82803
|
+
function convertTo$5(editor, blockData, doc2, type) {
|
|
82804
|
+
const { embedData } = blockData;
|
|
82805
|
+
const data2 = embedData;
|
|
82806
|
+
if (type === "html") {
|
|
82807
|
+
if (data2.src) {
|
|
82808
|
+
return `<img src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
|
|
82809
|
+
}
|
|
82810
|
+
if (data2.xmlSvg) {
|
|
82811
|
+
return data2.xmlSvg;
|
|
82812
|
+
}
|
|
82813
|
+
return "<p>[drawio]</p>";
|
|
82814
|
+
}
|
|
82815
|
+
if (type === "markdown") {
|
|
82816
|
+
if (data2.src) {
|
|
82817
|
+
return `})`;
|
|
82818
|
+
}
|
|
82819
|
+
if (data2.xmlSvg) {
|
|
82820
|
+
return data2.xmlSvg;
|
|
82821
|
+
}
|
|
82822
|
+
return "[drawio]";
|
|
82823
|
+
}
|
|
82824
|
+
return "";
|
|
82825
|
+
}
|
|
82826
|
+
const DrawioEmbed = {
|
|
82827
|
+
embedType: "drawio",
|
|
82828
|
+
getOptions: getOptions$3,
|
|
82829
|
+
createEmbedContent: createEmbedContent$5,
|
|
82830
|
+
handleUpdateBlock: handleUpdateBlock$4,
|
|
82831
|
+
getBlockProperties: getBlockProperties$5,
|
|
82832
|
+
convertTo: convertTo$5
|
|
82833
|
+
};
|
|
82834
|
+
class DrawioPasteHandler {
|
|
82835
|
+
constructor(editor) {
|
|
82836
|
+
__publicField(this, "handleBeforePasteDoc", async (editor, doc2) => {
|
|
82837
|
+
Object.values(doc2.blocks).forEach((blocks) => {
|
|
82838
|
+
var _a;
|
|
82839
|
+
for (let i = blocks.length - 1; i >= 0; i -= 1) {
|
|
82840
|
+
const block = blocks[i];
|
|
82841
|
+
if (block.type === "embed" && block.embedType === "drawio") {
|
|
82842
|
+
const src = ((_a = block.embedData) == null ? void 0 : _a.src) || "";
|
|
82843
|
+
if (!this.isSameOrigin(editor, doc2, src)) {
|
|
82844
|
+
blocks.splice(i, 1);
|
|
82845
|
+
}
|
|
82846
|
+
}
|
|
82847
|
+
}
|
|
82848
|
+
});
|
|
82849
|
+
return false;
|
|
82850
|
+
});
|
|
82851
|
+
this.editor = editor;
|
|
82852
|
+
setTimeout(() => {
|
|
82853
|
+
this.editor.input.addHandler(this);
|
|
82854
|
+
});
|
|
82855
|
+
}
|
|
82856
|
+
isSameOrigin(editor, doc2, src) {
|
|
82857
|
+
var _a, _b;
|
|
82858
|
+
const apiServer = ((_b = (_a = editor.doc).getServerMeta) == null ? void 0 : _b.call(_a).apiServer) || window.location.origin;
|
|
82859
|
+
const origin = new URL(apiServer).origin;
|
|
82860
|
+
const docServer = src.startsWith("http") ? src : doc2.meta.apiServer;
|
|
82861
|
+
return (docServer == null ? void 0 : docServer.startsWith(origin)) || false;
|
|
82862
|
+
}
|
|
82863
|
+
destroy() {
|
|
82864
|
+
}
|
|
82865
|
+
}
|
|
82866
|
+
const style = "";
|
|
81924
82867
|
function getChildContainers(editor, block, from, to) {
|
|
81925
82868
|
const contents = Array.from(
|
|
81926
82869
|
block.querySelectorAll(':scope > .layout-root > [data-type="editor-container"].child')
|
|
@@ -81938,7 +82881,7 @@ ${content}
|
|
|
81938
82881
|
);
|
|
81939
82882
|
return contents;
|
|
81940
82883
|
}
|
|
81941
|
-
const zhCN$
|
|
82884
|
+
const zhCN$5 = {
|
|
81942
82885
|
layout: {
|
|
81943
82886
|
title: "\u5206\u680F",
|
|
81944
82887
|
columnDrag: "\u957F\u6309\u62D6\u62FD\n\u70B9\u51FB\u53EF\u64CD\u4F5C\u5220\u9664",
|
|
@@ -81947,7 +82890,7 @@ ${content}
|
|
|
81947
82890
|
currentCols: "{currentColumns} \u680F"
|
|
81948
82891
|
}
|
|
81949
82892
|
};
|
|
81950
|
-
const enUS$
|
|
82893
|
+
const enUS$5 = {
|
|
81951
82894
|
layout: {
|
|
81952
82895
|
title: "Column",
|
|
81953
82896
|
columnDrag: "Click and hold the column to drag it.\nClick to delete it.",
|
|
@@ -81956,7 +82899,7 @@ ${content}
|
|
|
81956
82899
|
currentCols: "{currentColumns} columns"
|
|
81957
82900
|
}
|
|
81958
82901
|
};
|
|
81959
|
-
const jaJP$
|
|
82902
|
+
const jaJP$5 = {
|
|
81960
82903
|
layout: {
|
|
81961
82904
|
title: "\u6BB5\u7D44\u307F",
|
|
81962
82905
|
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",
|
|
@@ -81966,9 +82909,9 @@ ${content}
|
|
|
81966
82909
|
}
|
|
81967
82910
|
};
|
|
81968
82911
|
i18n$1.mergeLang({
|
|
81969
|
-
"zh-CN": zhCN$
|
|
81970
|
-
"en-US": enUS$
|
|
81971
|
-
"ja-JP": jaJP$
|
|
82912
|
+
"zh-CN": zhCN$5,
|
|
82913
|
+
"en-US": enUS$5,
|
|
82914
|
+
"ja-JP": jaJP$5
|
|
81972
82915
|
});
|
|
81973
82916
|
const layoutStyles = "";
|
|
81974
82917
|
const LAYOUT_NAME = "LayoutBlock";
|
|
@@ -82307,7 +83250,7 @@ ${content}
|
|
|
82307
83250
|
}
|
|
82308
83251
|
return void 0;
|
|
82309
83252
|
};
|
|
82310
|
-
const logger$
|
|
83253
|
+
const logger$h = getLogger("table-creator");
|
|
82311
83254
|
class LayoutCreatorItem {
|
|
82312
83255
|
constructor() {
|
|
82313
83256
|
__publicField(this, "id", "insert-layout");
|
|
@@ -82332,7 +83275,7 @@ ${content}
|
|
|
82332
83275
|
event.preventDefault();
|
|
82333
83276
|
event.stopPropagation();
|
|
82334
83277
|
const target = event.target;
|
|
82335
|
-
assert(logger$
|
|
83278
|
+
assert(logger$h, target instanceof HTMLElement, "invalid event target");
|
|
82336
83279
|
if (!this.colCount || this.colCount < 2) {
|
|
82337
83280
|
return;
|
|
82338
83281
|
}
|
|
@@ -82349,9 +83292,9 @@ ${content}
|
|
|
82349
83292
|
});
|
|
82350
83293
|
__publicField(this, "handleLayoutCreatorColumnEnter", (event) => {
|
|
82351
83294
|
const target = event.target;
|
|
82352
|
-
assert(logger$
|
|
83295
|
+
assert(logger$h, target instanceof HTMLElement, "invalid event target");
|
|
82353
83296
|
const id = target.id;
|
|
82354
|
-
assert(logger$
|
|
83297
|
+
assert(logger$h, id.startsWith(this.classPrefix.column), "invalid cell id");
|
|
82355
83298
|
const col = id.substring(this.classPrefix.column.length);
|
|
82356
83299
|
const colIndex = Number.parseInt(col, 10);
|
|
82357
83300
|
this.colCount = colIndex + 1;
|
|
@@ -82538,7 +83481,7 @@ ${content}
|
|
|
82538
83481
|
headingCollapsable: true,
|
|
82539
83482
|
previewNoShadow: true
|
|
82540
83483
|
});
|
|
82541
|
-
const logger$
|
|
83484
|
+
const logger$g = getLogger("layout-block");
|
|
82542
83485
|
const updateSelection = (editor, block, from, to) => {
|
|
82543
83486
|
var _a;
|
|
82544
83487
|
const childrenIds = (_a = editor.getBlockData(block).children) != null ? _a : [];
|
|
@@ -82553,8 +83496,8 @@ ${content}
|
|
|
82553
83496
|
});
|
|
82554
83497
|
};
|
|
82555
83498
|
const getSelectedContainers = (editor, complexBlock, start, end) => {
|
|
82556
|
-
assert(logger$
|
|
82557
|
-
assert(logger$
|
|
83499
|
+
assert(logger$g, start.blockId === end.blockId, "Start and end block must be the same");
|
|
83500
|
+
assert(logger$g, start.blockId === complexBlock.id, "Start block must be the same as complex block");
|
|
82558
83501
|
return getChildContainers(editor, complexBlock, start.childContainerId, end.childContainerId);
|
|
82559
83502
|
};
|
|
82560
83503
|
const getTextToolbarReferenceClient = (editor, block) => {
|
|
@@ -83288,7 +84231,7 @@ ${content}
|
|
|
83288
84231
|
}
|
|
83289
84232
|
return null;
|
|
83290
84233
|
};
|
|
83291
|
-
const getOptions$
|
|
84234
|
+
const getOptions$2 = (editor) => getLayoutOptions();
|
|
83292
84235
|
const LayoutBlock = {
|
|
83293
84236
|
blockType: LAYOUT_BLOCK_TYPE,
|
|
83294
84237
|
blockKind: "complex",
|
|
@@ -83308,7 +84251,7 @@ ${content}
|
|
|
83308
84251
|
getChildContainers: (editor, block) => getChildContainers(editor, block),
|
|
83309
84252
|
getNextContainer,
|
|
83310
84253
|
getSelectedContainers,
|
|
83311
|
-
getOptions: getOptions$
|
|
84254
|
+
getOptions: getOptions$2,
|
|
83312
84255
|
handleDrop,
|
|
83313
84256
|
handleDropOver,
|
|
83314
84257
|
getTextToolbarReferenceClient,
|
|
@@ -83339,7 +84282,7 @@ ${content}
|
|
|
83339
84282
|
}
|
|
83340
84283
|
};
|
|
83341
84284
|
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>';
|
|
83342
|
-
const logger$
|
|
84285
|
+
const logger$f = getLogger("webpage");
|
|
83343
84286
|
class WebPage {
|
|
83344
84287
|
constructor(editor, blockData) {
|
|
83345
84288
|
__publicField(this, "currentSrc", "");
|
|
@@ -83381,7 +84324,7 @@ ${content}
|
|
|
83381
84324
|
const iframe = createElement("iframe", ["editor-preview-iframe"], internalContainer);
|
|
83382
84325
|
this.loading = this.createLoading(internalContainer);
|
|
83383
84326
|
const handleIframeLoaded = () => {
|
|
83384
|
-
assert(logger$
|
|
84327
|
+
assert(logger$f, this.loading, "not created");
|
|
83385
84328
|
this.loading.hide();
|
|
83386
84329
|
this.currentSrc = src;
|
|
83387
84330
|
};
|
|
@@ -83393,12 +84336,12 @@ ${content}
|
|
|
83393
84336
|
this.createMask(editor, block);
|
|
83394
84337
|
}
|
|
83395
84338
|
update(editor, block, embedData) {
|
|
83396
|
-
assert(logger$
|
|
84339
|
+
assert(logger$f, this.loading, "not created");
|
|
83397
84340
|
if (this.currentSrc === embedData.src) {
|
|
83398
84341
|
return;
|
|
83399
84342
|
}
|
|
83400
84343
|
const iframe = block.querySelector(".editor-preview-iframe");
|
|
83401
|
-
assert(logger$
|
|
84344
|
+
assert(logger$f, iframe, "no exists iframe");
|
|
83402
84345
|
this.loading.show();
|
|
83403
84346
|
iframe.src = embedData.src;
|
|
83404
84347
|
this.createMask(editor, block);
|
|
@@ -83514,7 +84457,7 @@ ${content}
|
|
|
83514
84457
|
}
|
|
83515
84458
|
}
|
|
83516
84459
|
const index$3 = "";
|
|
83517
|
-
const logger$
|
|
84460
|
+
const logger$e = getLogger("editor-dialog");
|
|
83518
84461
|
function createContainer(content, options) {
|
|
83519
84462
|
const container = createElement("div", ["editor-dialog-container"], null);
|
|
83520
84463
|
const header = createElement("div", ["dialog-header"], container);
|
|
@@ -83538,7 +84481,7 @@ ${content}
|
|
|
83538
84481
|
const y = document.documentElement.clientHeight / 2;
|
|
83539
84482
|
const x = document.documentElement.clientWidth / 2;
|
|
83540
84483
|
const rootElement = this.getCommandBarRoot();
|
|
83541
|
-
assert(logger$
|
|
84484
|
+
assert(logger$e, rootElement, "no command bar root");
|
|
83542
84485
|
const { width, height } = rootElement.getBoundingClientRect();
|
|
83543
84486
|
return new DOMRect(Math.max(x - width / 2, 0), Math.max(y - height / 2, 0), 0, 0);
|
|
83544
84487
|
});
|
|
@@ -83773,7 +84716,7 @@ ${content}
|
|
|
83773
84716
|
window.open(src, "_blank");
|
|
83774
84717
|
return true;
|
|
83775
84718
|
}
|
|
83776
|
-
function getBlockProperties$
|
|
84719
|
+
function getBlockProperties$4(editor, block) {
|
|
83777
84720
|
const properties = getStandardEmbedBlockProperties(editor, block, {
|
|
83778
84721
|
presetIds: [],
|
|
83779
84722
|
extCommands: editor.readonly ? [] : [{
|
|
@@ -83801,12 +84744,12 @@ ${content}
|
|
|
83801
84744
|
abstract
|
|
83802
84745
|
};
|
|
83803
84746
|
}
|
|
83804
|
-
const logger$
|
|
83805
|
-
function createEmbedContent$
|
|
84747
|
+
const logger$d = getLogger("webpage-embed");
|
|
84748
|
+
function createEmbedContent$4(editor, content, blockData, path, container, block) {
|
|
83806
84749
|
const { embedData, id } = blockData;
|
|
83807
84750
|
const { src } = embedData;
|
|
83808
84751
|
const webpage = editor.addCustom(`webpage-${id}`, () => new WebPage(editor, blockData));
|
|
83809
|
-
assert(logger$
|
|
84752
|
+
assert(logger$d, src, "The src from blockData is invalid ");
|
|
83810
84753
|
webpage.create(editor, embedData, content, block);
|
|
83811
84754
|
setTimeout(() => {
|
|
83812
84755
|
if (editor.isBlockWritable(block) && !clientType.isMobile) {
|
|
@@ -83817,7 +84760,7 @@ ${content}
|
|
|
83817
84760
|
block.style.height = `${blockData.height}px`;
|
|
83818
84761
|
}
|
|
83819
84762
|
}
|
|
83820
|
-
function handleUpdateBlock$
|
|
84763
|
+
function handleUpdateBlock$3(editor, block, blockData) {
|
|
83821
84764
|
const { embedData, id } = blockData;
|
|
83822
84765
|
const webpage = editor.getCustom(`webpage-${id}`);
|
|
83823
84766
|
webpage.update(editor, block, embedData);
|
|
@@ -83826,14 +84769,14 @@ ${content}
|
|
|
83826
84769
|
}
|
|
83827
84770
|
return true;
|
|
83828
84771
|
}
|
|
83829
|
-
function getOptions$
|
|
84772
|
+
function getOptions$1(editor) {
|
|
83830
84773
|
return {
|
|
83831
84774
|
name: "WebPage",
|
|
83832
84775
|
insertEmbedCommandItems: getAllowedWebPages(editor),
|
|
83833
84776
|
handleInsertEmptyEmbed
|
|
83834
84777
|
};
|
|
83835
84778
|
}
|
|
83836
|
-
function convertTo$
|
|
84779
|
+
function convertTo$4(editor, blockData, doc2, type) {
|
|
83837
84780
|
const webpage = blockData.embedData;
|
|
83838
84781
|
const url = webpage.src;
|
|
83839
84782
|
if (type === "html") {
|
|
@@ -83846,13 +84789,13 @@ ${content}
|
|
|
83846
84789
|
}
|
|
83847
84790
|
const WebPageEmbed = {
|
|
83848
84791
|
embedType: "webpage",
|
|
83849
|
-
createEmbedContent: createEmbedContent$
|
|
83850
|
-
getBlockProperties: getBlockProperties$
|
|
83851
|
-
getOptions: getOptions$
|
|
83852
|
-
handleUpdateBlock: handleUpdateBlock$
|
|
83853
|
-
convertTo: convertTo$
|
|
84792
|
+
createEmbedContent: createEmbedContent$4,
|
|
84793
|
+
getBlockProperties: getBlockProperties$4,
|
|
84794
|
+
getOptions: getOptions$1,
|
|
84795
|
+
handleUpdateBlock: handleUpdateBlock$3,
|
|
84796
|
+
convertTo: convertTo$4
|
|
83854
84797
|
};
|
|
83855
|
-
const zhCN$
|
|
84798
|
+
const zhCN$4 = {
|
|
83856
84799
|
webpage: {
|
|
83857
84800
|
title: "\u7F51\u9875",
|
|
83858
84801
|
youku: "\u4F18\u9177\u89C6\u9891",
|
|
@@ -83878,7 +84821,7 @@ ${content}
|
|
|
83878
84821
|
}
|
|
83879
84822
|
}
|
|
83880
84823
|
};
|
|
83881
|
-
const enUS$
|
|
84824
|
+
const enUS$4 = {
|
|
83882
84825
|
webpage: {
|
|
83883
84826
|
title: "Webpage",
|
|
83884
84827
|
youku: "Youku",
|
|
@@ -83904,7 +84847,7 @@ ${content}
|
|
|
83904
84847
|
}
|
|
83905
84848
|
}
|
|
83906
84849
|
};
|
|
83907
|
-
const jaJP$
|
|
84850
|
+
const jaJP$4 = {
|
|
83908
84851
|
webpage: {
|
|
83909
84852
|
title: "Web \u30DA\u30FC\u30B8",
|
|
83910
84853
|
youku: "Youku \u52D5\u753B",
|
|
@@ -83931,859 +84874,11 @@ ${content}
|
|
|
83931
84874
|
}
|
|
83932
84875
|
};
|
|
83933
84876
|
i18n$1.mergeLang({
|
|
83934
|
-
"zh-CN": zhCN$5,
|
|
83935
|
-
"en-US": enUS$5,
|
|
83936
|
-
"ja-JP": jaJP$5
|
|
83937
|
-
});
|
|
83938
|
-
const webpageStyle = "";
|
|
83939
|
-
function getContentTypeFromHeaders(headers) {
|
|
83940
|
-
const entries = Object.entries(headers);
|
|
83941
|
-
for (let i = 0; i < entries.length; i++) {
|
|
83942
|
-
const [key, value] = entries[i];
|
|
83943
|
-
if (key.toLocaleLowerCase() === "content-type") {
|
|
83944
|
-
return value;
|
|
83945
|
-
}
|
|
83946
|
-
}
|
|
83947
|
-
return "";
|
|
83948
|
-
}
|
|
83949
|
-
async function downloadImageToFile(editor, src, withCredentials = true) {
|
|
83950
|
-
try {
|
|
83951
|
-
const res = await editor.doc.request(src, {
|
|
83952
|
-
method: "get",
|
|
83953
|
-
responseType: "blob",
|
|
83954
|
-
withCredentials
|
|
83955
|
-
});
|
|
83956
|
-
const reader = new FileReader();
|
|
83957
|
-
const promise = new Promise((resolve, reject) => {
|
|
83958
|
-
reader.onload = resolve;
|
|
83959
|
-
reader.onerror = reject;
|
|
83960
|
-
});
|
|
83961
|
-
reader.readAsArrayBuffer(res.data);
|
|
83962
|
-
await promise;
|
|
83963
|
-
const buffer = reader.result;
|
|
83964
|
-
const contentType = getContentTypeFromHeaders(res.headers).toLocaleLowerCase();
|
|
83965
|
-
let ext = "";
|
|
83966
|
-
if (contentType) {
|
|
83967
|
-
const extensions = mime__default.default[contentType].extensions;
|
|
83968
|
-
if (extensions && extensions.length > 0) {
|
|
83969
|
-
ext = extensions[0];
|
|
83970
|
-
}
|
|
83971
|
-
}
|
|
83972
|
-
const file2 = new File([buffer], `${Date.now()}.${ext}`, {
|
|
83973
|
-
type: contentType
|
|
83974
|
-
});
|
|
83975
|
-
return file2;
|
|
83976
|
-
} catch (err) {
|
|
83977
|
-
return null;
|
|
83978
|
-
}
|
|
83979
|
-
}
|
|
83980
|
-
async function downloadObjectToFile(editor, url) {
|
|
83981
|
-
const file2 = await downloadImageToFile(editor, url);
|
|
83982
|
-
return file2;
|
|
83983
|
-
}
|
|
83984
|
-
async function downloadSvgToString(editor, url) {
|
|
83985
|
-
const file2 = await downloadObjectToFile(editor, url);
|
|
83986
|
-
if (!file2)
|
|
83987
|
-
return null;
|
|
83988
|
-
const text2 = await file2.text();
|
|
83989
|
-
return text2;
|
|
83990
|
-
}
|
|
83991
|
-
const isEmptyImage = (svg) => {
|
|
83992
|
-
if (svg.naturalWidth <= 1 && svg.naturalHeight <= 1) {
|
|
83993
|
-
return true;
|
|
83994
|
-
}
|
|
83995
|
-
return false;
|
|
83996
|
-
};
|
|
83997
|
-
const isEmptySvg = (svg) => {
|
|
83998
|
-
var _a, _b;
|
|
83999
|
-
const widthStr = (_a = svg.getAttribute("width")) != null ? _a : "";
|
|
84000
|
-
const heightStr = (_b = svg.getAttribute("height")) != null ? _b : "";
|
|
84001
|
-
const width = Number.parseInt(widthStr, 10);
|
|
84002
|
-
const height = Number.parseInt(heightStr, 10);
|
|
84003
|
-
if (!width || !height) {
|
|
84004
|
-
return true;
|
|
84005
|
-
}
|
|
84006
|
-
if (width <= 1 && height <= 1) {
|
|
84007
|
-
return true;
|
|
84008
|
-
}
|
|
84009
|
-
return false;
|
|
84010
|
-
};
|
|
84011
|
-
const getTextContent = (node) => node != null ? node[node.textContent === void 0 ? "text" : "textContent"] : "";
|
|
84012
|
-
function loopCheckResourceWasLoaded(options) {
|
|
84013
|
-
const { checker, maxRetryTime } = options;
|
|
84014
|
-
const startTime = Date.now();
|
|
84015
|
-
return new Promise((resolve, reject) => {
|
|
84016
|
-
function check() {
|
|
84017
|
-
try {
|
|
84018
|
-
if (checker()) {
|
|
84019
|
-
resolve();
|
|
84020
|
-
} else if (Date.now() - startTime > maxRetryTime) {
|
|
84021
|
-
reject(new Error("Max retry time exceeded"));
|
|
84022
|
-
} else {
|
|
84023
|
-
setTimeout(check, 100);
|
|
84024
|
-
}
|
|
84025
|
-
} catch (error2) {
|
|
84026
|
-
reject(error2);
|
|
84027
|
-
}
|
|
84028
|
-
}
|
|
84029
|
-
check();
|
|
84030
|
-
});
|
|
84031
|
-
}
|
|
84032
|
-
const DrawioLang = {
|
|
84033
|
-
"zh-CN": "zh",
|
|
84034
|
-
"zh-TW": "zh-tw",
|
|
84035
|
-
"ja-JP": "ja",
|
|
84036
|
-
"en-US": "en"
|
|
84037
|
-
};
|
|
84038
|
-
const drawioIframeUrl = "https://embed.diagrams.net/?embed=1";
|
|
84039
|
-
const DrawioJsUrl = "https://www.draw.io/embed.js";
|
|
84040
|
-
const PakoJsUrl = "https://cdn.jsdelivr.net/npm/pako@2.0.3/dist/pako.es5.js";
|
|
84041
|
-
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';
|
|
84042
|
-
const DEFAULT_STYLES = `
|
|
84043
|
-
<mxStylesheet>
|
|
84044
|
-
<add as="defaultVertex">
|
|
84045
|
-
<add as="shape" value="label"/>
|
|
84046
|
-
<add as="perimeter" value="rectanglePerimeter"/>
|
|
84047
|
-
<add as="fontSize" value="12"/>
|
|
84048
|
-
<add as="fontFamily" value="Helvetica"/>
|
|
84049
|
-
<add as="align" value="center"/>
|
|
84050
|
-
<add as="verticalAlign" value="middle"/>
|
|
84051
|
-
<add as="fillColor" value="#ffffff"/>
|
|
84052
|
-
<add as="strokeColor" value="#000000"/>
|
|
84053
|
-
<add as="fontColor" value="#000000"/>
|
|
84054
|
-
</add>
|
|
84055
|
-
<add as="defaultEdge">
|
|
84056
|
-
<add as="shape" value="connector"/>
|
|
84057
|
-
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
84058
|
-
<add as="endArrow" value="classic"/>
|
|
84059
|
-
<add as="fontSize" value="11"/>
|
|
84060
|
-
<add as="fontFamily" value="Helvetica"/>
|
|
84061
|
-
<add as="align" value="center"/>
|
|
84062
|
-
<add as="verticalAlign" value="middle"/>
|
|
84063
|
-
<add as="rounded" value="1"/>
|
|
84064
|
-
<add as="strokeColor" value="#000000"/>
|
|
84065
|
-
<add as="fontColor" value="#000000"/>
|
|
84066
|
-
</add>
|
|
84067
|
-
<add as="text">
|
|
84068
|
-
<add as="fillColor" value="none"/>
|
|
84069
|
-
<add as="gradientColor" value="none"/>
|
|
84070
|
-
<add as="strokeColor" value="none"/>
|
|
84071
|
-
<add as="align" value="left"/>
|
|
84072
|
-
<add as="verticalAlign" value="top"/>
|
|
84073
|
-
</add>
|
|
84074
|
-
<add as="edgeLabel" extend="text">
|
|
84075
|
-
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
84076
|
-
<add as="fontSize" value="11"/>
|
|
84077
|
-
</add>
|
|
84078
|
-
<add as="label">
|
|
84079
|
-
<add as="fontStyle" value="1"/>
|
|
84080
|
-
<add as="align" value="left"/>
|
|
84081
|
-
<add as="verticalAlign" value="middle"/>
|
|
84082
|
-
<add as="spacing" value="2"/>
|
|
84083
|
-
<add as="spacingLeft" value="52"/>
|
|
84084
|
-
<add as="imageWidth" value="42"/>
|
|
84085
|
-
<add as="imageHeight" value="42"/>
|
|
84086
|
-
<add as="rounded" value="1"/>
|
|
84087
|
-
</add>
|
|
84088
|
-
<add as="icon" extend="label">
|
|
84089
|
-
<add as="align" value="center"/>
|
|
84090
|
-
<add as="imageAlign" value="center"/>
|
|
84091
|
-
<add as="verticalLabelPosition" value="bottom"/>
|
|
84092
|
-
<add as="verticalAlign" value="top"/>
|
|
84093
|
-
<add as="spacingTop" value="4"/>
|
|
84094
|
-
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
84095
|
-
<add as="spacing" value="0"/>
|
|
84096
|
-
<add as="spacingLeft" value="0"/>
|
|
84097
|
-
<add as="spacingTop" value="6"/>
|
|
84098
|
-
<add as="fontStyle" value="0"/>
|
|
84099
|
-
<add as="imageWidth" value="48"/>
|
|
84100
|
-
<add as="imageHeight" value="48"/>
|
|
84101
|
-
</add>
|
|
84102
|
-
<add as="swimlane">
|
|
84103
|
-
<add as="shape" value="swimlane"/>
|
|
84104
|
-
<add as="fontSize" value="12"/>
|
|
84105
|
-
<add as="fontStyle" value="1"/>
|
|
84106
|
-
<add as="startSize" value="23"/>
|
|
84107
|
-
</add>
|
|
84108
|
-
<add as="group">
|
|
84109
|
-
<add as="verticalAlign" value="top"/>
|
|
84110
|
-
<add as="fillColor" value="none"/>
|
|
84111
|
-
<add as="strokeColor" value="none"/>
|
|
84112
|
-
<add as="gradientColor" value="none"/>
|
|
84113
|
-
<add as="pointerEvents" value="0"/>
|
|
84114
|
-
</add>
|
|
84115
|
-
<add as="ellipse">
|
|
84116
|
-
<add as="shape" value="ellipse"/>
|
|
84117
|
-
<add as="perimeter" value="ellipsePerimeter"/>
|
|
84118
|
-
</add>
|
|
84119
|
-
<add as="rhombus">
|
|
84120
|
-
<add as="shape" value="rhombus"/>
|
|
84121
|
-
<add as="perimeter" value="rhombusPerimeter"/>
|
|
84122
|
-
</add>
|
|
84123
|
-
<add as="triangle">
|
|
84124
|
-
<add as="shape" value="triangle"/>
|
|
84125
|
-
<add as="perimeter" value="trianglePerimeter"/>
|
|
84126
|
-
</add>
|
|
84127
|
-
<add as="line">
|
|
84128
|
-
<add as="shape" value="line"/>
|
|
84129
|
-
<add as="strokeWidth" value="4"/>
|
|
84130
|
-
<add as="labelBackgroundColor" value="#ffffff"/>
|
|
84131
|
-
<add as="verticalAlign" value="top"/>
|
|
84132
|
-
<add as="spacingTop" value="8"/>
|
|
84133
|
-
</add>
|
|
84134
|
-
<add as="image">
|
|
84135
|
-
<add as="shape" value="image"/>
|
|
84136
|
-
<add as="labelBackgroundColor" value="white"/>
|
|
84137
|
-
<add as="verticalAlign" value="top"/>
|
|
84138
|
-
<add as="verticalLabelPosition" value="bottom"/>
|
|
84139
|
-
</add>
|
|
84140
|
-
<add as="roundImage" extend="image">
|
|
84141
|
-
<add as="perimeter" value="ellipsePerimeter"/>
|
|
84142
|
-
</add>
|
|
84143
|
-
<add as="rhombusImage" extend="image">
|
|
84144
|
-
<add as="perimeter" value="rhombusPerimeter"/>
|
|
84145
|
-
</add>
|
|
84146
|
-
<add as="arrow">
|
|
84147
|
-
<add as="shape" value="arrow"/>
|
|
84148
|
-
<add as="edgeStyle" value="none"/>
|
|
84149
|
-
<add as="fillColor" value="#ffffff"/>
|
|
84150
|
-
</add>
|
|
84151
|
-
</mxStylesheet>
|
|
84152
|
-
`;
|
|
84153
|
-
const BORDER = 0;
|
|
84154
|
-
const SAVE_DELAY_TIME = 30 * 1e3;
|
|
84155
|
-
const DRAWIO_EMPTY_CLASS = "editor-empty-drawio";
|
|
84156
|
-
const SHOW_FULL_SCREEN_IFRAME = "show-full-screen-iframe";
|
|
84157
|
-
const logger$e = getLogger("embed-block-drawio");
|
|
84158
|
-
function getDrawioOptions(editor) {
|
|
84159
|
-
const compOptions = editor.options.componentsOptions;
|
|
84160
|
-
return compOptions.drawIO || {};
|
|
84161
|
-
}
|
|
84162
|
-
function getDrawioLang(editor) {
|
|
84163
|
-
const options = getDrawioOptions(editor);
|
|
84164
|
-
const lang = options.lang;
|
|
84165
|
-
return lang ? DrawioLang[lang] : "";
|
|
84166
|
-
}
|
|
84167
|
-
function getDrawioIframeUrl(editor) {
|
|
84168
|
-
var _a;
|
|
84169
|
-
const options = getDrawioOptions(editor) || {};
|
|
84170
|
-
const iframeUrl = ((_a = options.cdn) == null ? void 0 : _a.drawioIframe) || drawioIframeUrl;
|
|
84171
|
-
const lang = getDrawioLang(editor);
|
|
84172
|
-
return updateUrl(iframeUrl, {
|
|
84173
|
-
spin: 1,
|
|
84174
|
-
proto: "json",
|
|
84175
|
-
configure: 1,
|
|
84176
|
-
lang
|
|
84177
|
-
});
|
|
84178
|
-
}
|
|
84179
|
-
function resizeObserver(el) {
|
|
84180
|
-
const resize = () => {
|
|
84181
|
-
assert(logger$e, el, "el does not exist");
|
|
84182
|
-
const width = document.body.clientWidth || document.documentElement.clientWidth;
|
|
84183
|
-
const height = document.body.clientHeight || document.documentElement.clientHeight;
|
|
84184
|
-
el.setAttribute("width", `${width - 2 * BORDER}`);
|
|
84185
|
-
el.setAttribute("height", `${height - 2 * BORDER}`);
|
|
84186
|
-
};
|
|
84187
|
-
const disconnect = () => {
|
|
84188
|
-
window.removeEventListener("resize", resize);
|
|
84189
|
-
};
|
|
84190
|
-
resize();
|
|
84191
|
-
window.addEventListener("resize", resize);
|
|
84192
|
-
return {
|
|
84193
|
-
disconnect
|
|
84194
|
-
};
|
|
84195
|
-
}
|
|
84196
|
-
async function initializeDrawioIframe(editor, block) {
|
|
84197
|
-
const options = getDrawioOptions(editor) || {};
|
|
84198
|
-
const callbacks = options.callbacks || {};
|
|
84199
|
-
const docReAuthCallbacks = editor.getCustom(DOC_RE_AUTH_KEYS);
|
|
84200
|
-
const { onCreateDrawIoFrame, onCloseDrawIoFrame } = callbacks;
|
|
84201
|
-
let drawioIframe = null;
|
|
84202
|
-
let exit;
|
|
84203
|
-
if (onCreateDrawIoFrame) {
|
|
84204
|
-
drawioIframe = await onCreateDrawIoFrame(editor);
|
|
84205
|
-
assert(logger$e, drawioIframe, "iframe create failed");
|
|
84206
|
-
exit = () => {
|
|
84207
|
-
assert(logger$e, drawioIframe, "iframe does not exist");
|
|
84208
|
-
assert(logger$e, onCloseDrawIoFrame, "missing parameters: onCloseDrawIoFrame");
|
|
84209
|
-
docReAuthCallbacks.removeListeners();
|
|
84210
|
-
onCloseDrawIoFrame(editor, drawioIframe);
|
|
84211
|
-
};
|
|
84212
|
-
} else {
|
|
84213
|
-
const drawioContainer = createElement("div", ["editor-drawio-iframe-container", "loading"], document.body);
|
|
84214
|
-
drawioContainer.setAttribute("data-placeholder", i18n$1.t("drawio.loading"));
|
|
84215
|
-
drawioIframe = createElement("iframe", ["drawio-iframe-element"], drawioContainer);
|
|
84216
|
-
drawioIframe.setAttribute("frameborder", "0");
|
|
84217
|
-
addClass(drawioContainer, SHOW_FULL_SCREEN_IFRAME);
|
|
84218
|
-
const { disconnect } = resizeObserver(drawioIframe);
|
|
84219
|
-
exit = () => {
|
|
84220
|
-
assert(logger$e, drawioIframe, "iframe does not exist");
|
|
84221
|
-
docReAuthCallbacks.removeListeners();
|
|
84222
|
-
disconnect();
|
|
84223
|
-
document.body.removeChild(drawioContainer);
|
|
84224
|
-
removeClass(drawioContainer, SHOW_FULL_SCREEN_IFRAME);
|
|
84225
|
-
};
|
|
84226
|
-
}
|
|
84227
|
-
docReAuthCallbacks.addAuthListen("authError", () => {
|
|
84228
|
-
logger$e.debug("authError! render error toolbar");
|
|
84229
|
-
docReAuthCallbacks.reAuthToolbar.render(block, exit);
|
|
84230
|
-
});
|
|
84231
|
-
return {
|
|
84232
|
-
drawioIframe,
|
|
84233
|
-
exit
|
|
84234
|
-
};
|
|
84235
|
-
}
|
|
84236
|
-
async function saveSvgToBlock(editor, block, svg, autoSave) {
|
|
84237
|
-
var _a, _b;
|
|
84238
|
-
try {
|
|
84239
|
-
if (autoSave) {
|
|
84240
|
-
logger$e.debug("auto saving drawio data");
|
|
84241
|
-
}
|
|
84242
|
-
const regex = /(<svg [^<>]* )modified="[^&]*"([^<>]* )etag="[^&]*"/gm;
|
|
84243
|
-
const subst = "$1$2";
|
|
84244
|
-
const normalizedSvg = svg.replace(regex, subst);
|
|
84245
|
-
const blob = new Blob([normalizedSvg]);
|
|
84246
|
-
const file2 = new File([blob], "drawio.svg", {
|
|
84247
|
-
type: "image/svg+xml"
|
|
84248
|
-
});
|
|
84249
|
-
const targetBlock = editor.findBlockById(getBlockId(block));
|
|
84250
|
-
if (targetBlock) {
|
|
84251
|
-
const res = await editor.doc.uploadResource(file2);
|
|
84252
|
-
const { resourceId } = res;
|
|
84253
|
-
const oldData = editor.getBlockData(targetBlock);
|
|
84254
|
-
const oldEmbedData = oldData.embedData;
|
|
84255
|
-
const newEmbedData = {
|
|
84256
|
-
src: resourceId,
|
|
84257
|
-
height: oldEmbedData == null ? void 0 : oldEmbedData.height
|
|
84258
|
-
};
|
|
84259
|
-
editor.updateEmbedData(targetBlock, newEmbedData);
|
|
84260
|
-
} else {
|
|
84261
|
-
logger$e.error("block has been deleted");
|
|
84262
|
-
}
|
|
84263
|
-
} catch (err) {
|
|
84264
|
-
const message = `failed to save drawio data: ${err.message}`;
|
|
84265
|
-
const options = getDrawioOptions(editor);
|
|
84266
|
-
if ((_a = options.callbacks) == null ? void 0 : _a.onError) {
|
|
84267
|
-
const newError = new Error(message);
|
|
84268
|
-
newError.code = "SaveDrawIo";
|
|
84269
|
-
(_b = options.callbacks) == null ? void 0 : _b.onError(editor, newError);
|
|
84270
|
-
}
|
|
84271
|
-
throw err;
|
|
84272
|
-
}
|
|
84273
|
-
}
|
|
84274
|
-
class LoadingHandler {
|
|
84275
|
-
constructor() {
|
|
84276
|
-
__publicField(this, "loadingContainer");
|
|
84277
|
-
__publicField(this, "setLoading", (iframe, placeholder2 = i18n$1.t("drawio.save")) => {
|
|
84278
|
-
const parent = iframe.parentElement;
|
|
84279
|
-
if (parent) {
|
|
84280
|
-
addClass(parent, "loading");
|
|
84281
|
-
parent.setAttribute("data-placeholder", placeholder2);
|
|
84282
|
-
}
|
|
84283
|
-
});
|
|
84284
|
-
__publicField(this, "removeLoading", () => {
|
|
84285
|
-
const containers = document.querySelectorAll(".editor-drawio-iframe-container");
|
|
84286
|
-
containers.forEach((r) => {
|
|
84287
|
-
removeClass(r, "loading");
|
|
84288
|
-
});
|
|
84289
|
-
});
|
|
84290
|
-
}
|
|
84291
|
-
}
|
|
84292
|
-
function contactWithIframe(editor, block, drawIoData, iframe, loaded, exit, isInitializationCompleted2) {
|
|
84293
|
-
const destroy = () => {
|
|
84294
|
-
window.removeEventListener("message", receive);
|
|
84295
|
-
exit();
|
|
84296
|
-
};
|
|
84297
|
-
const loadingHandler = new LoadingHandler();
|
|
84298
|
-
loadingHandler.setLoading(iframe, i18n$1.t("drawio.loading"));
|
|
84299
|
-
let exportFlag = "auto";
|
|
84300
|
-
const receive = async (evt) => {
|
|
84301
|
-
var _a, _b;
|
|
84302
|
-
assert(logger$e, iframe.contentWindow, "iframe.contentWindow does not exist");
|
|
84303
|
-
if (evt.data.length > 0) {
|
|
84304
|
-
const msg = JSON.parse(evt.data);
|
|
84305
|
-
const xml = drawIoData.xmlSvg || drawIoData.xml;
|
|
84306
|
-
switch (msg.event) {
|
|
84307
|
-
case "configure":
|
|
84308
|
-
iframe.contentWindow.postMessage(JSON.stringify({
|
|
84309
|
-
action: "configure",
|
|
84310
|
-
config: {
|
|
84311
|
-
defaultFonts: ["Humor Sans", "Helvetica", "Times New Roman"]
|
|
84312
|
-
}
|
|
84313
|
-
}), "*");
|
|
84314
|
-
break;
|
|
84315
|
-
case "init":
|
|
84316
|
-
if (xml != null) {
|
|
84317
|
-
iframe.contentWindow.postMessage(JSON.stringify({
|
|
84318
|
-
action: "load",
|
|
84319
|
-
saveAndExit: 1,
|
|
84320
|
-
noSaveBtn: 1,
|
|
84321
|
-
noExitBtn: 0,
|
|
84322
|
-
xml
|
|
84323
|
-
}), "*");
|
|
84324
|
-
}
|
|
84325
|
-
loaded();
|
|
84326
|
-
loadingHandler.removeLoading();
|
|
84327
|
-
break;
|
|
84328
|
-
case "save":
|
|
84329
|
-
exportFlag = "save";
|
|
84330
|
-
iframe.contentWindow.postMessage(JSON.stringify({
|
|
84331
|
-
action: "export",
|
|
84332
|
-
format: "xmlsvg",
|
|
84333
|
-
spin: "Saving graph"
|
|
84334
|
-
}), "*");
|
|
84335
|
-
break;
|
|
84336
|
-
case "export":
|
|
84337
|
-
if (exportFlag !== "auto") {
|
|
84338
|
-
loadingHandler.setLoading(iframe);
|
|
84339
|
-
}
|
|
84340
|
-
const svg = fromBase64(msg.data.substring(msg.data.indexOf(",") + 1));
|
|
84341
|
-
try {
|
|
84342
|
-
await saveSvgToBlock(editor, block, svg, !!((_a = msg.message) == null ? void 0 : _a.autoSave));
|
|
84343
|
-
if (!((_b = msg.message) == null ? void 0 : _b.autoSave)) {
|
|
84344
|
-
destroy();
|
|
84345
|
-
}
|
|
84346
|
-
} catch (error2) {
|
|
84347
|
-
const docReAuthCallbacks = editor.getCustom(DOC_RE_AUTH_KEYS);
|
|
84348
|
-
docReAuthCallbacks.emit("tokenExpired");
|
|
84349
|
-
if (exportFlag === "save") {
|
|
84350
|
-
docReAuthCallbacks.reAuthToolbar.render(block, exit);
|
|
84351
|
-
}
|
|
84352
|
-
}
|
|
84353
|
-
loadingHandler.removeLoading();
|
|
84354
|
-
exportFlag = "auto";
|
|
84355
|
-
break;
|
|
84356
|
-
case "exit":
|
|
84357
|
-
exportFlag = "exit";
|
|
84358
|
-
destroy();
|
|
84359
|
-
break;
|
|
84360
|
-
}
|
|
84361
|
-
}
|
|
84362
|
-
};
|
|
84363
|
-
window.addEventListener("message", receive);
|
|
84364
|
-
}
|
|
84365
|
-
async function editGraph(editor, block, data2, isInitializationCompleted2) {
|
|
84366
|
-
if (isInitializationCompleted2) {
|
|
84367
|
-
return;
|
|
84368
|
-
}
|
|
84369
|
-
isInitializationCompleted2 = true;
|
|
84370
|
-
const options = getDrawioOptions(editor) || {};
|
|
84371
|
-
const { callbacks } = options;
|
|
84372
|
-
let autoSaveInterval;
|
|
84373
|
-
if (callbacks && (callbacks == null ? void 0 : callbacks.onBeginInitDrawIo)) {
|
|
84374
|
-
callbacks.onBeginInitDrawIo(editor, block);
|
|
84375
|
-
}
|
|
84376
|
-
const { drawioIframe, exit: exitIframe } = await initializeDrawioIframe(editor, block);
|
|
84377
|
-
exclusiveBlock(editor, block);
|
|
84378
|
-
if (data2.src) {
|
|
84379
|
-
const svg = await downloadSvgToString(editor, editor.doc.buildResourceUrl(data2.src));
|
|
84380
|
-
if (svg) {
|
|
84381
|
-
data2.xmlSvg = svg;
|
|
84382
|
-
}
|
|
84383
|
-
}
|
|
84384
|
-
const loaded = () => {
|
|
84385
|
-
autoSaveInterval = setInterval(() => {
|
|
84386
|
-
if (!drawioIframe || !drawioIframe.contentWindow) {
|
|
84387
|
-
return;
|
|
84388
|
-
}
|
|
84389
|
-
drawioIframe.contentWindow.postMessage(JSON.stringify({
|
|
84390
|
-
action: "export",
|
|
84391
|
-
format: "xmlsvg",
|
|
84392
|
-
spin: "Saving graph",
|
|
84393
|
-
autoSave: true
|
|
84394
|
-
}), "*");
|
|
84395
|
-
}, SAVE_DELAY_TIME);
|
|
84396
|
-
};
|
|
84397
|
-
const exit = () => {
|
|
84398
|
-
exitIframe();
|
|
84399
|
-
if (autoSaveInterval) {
|
|
84400
|
-
clearInterval(autoSaveInterval);
|
|
84401
|
-
}
|
|
84402
|
-
const newBlock = editor.findBlockById(getBlockId(block));
|
|
84403
|
-
if (newBlock) {
|
|
84404
|
-
unexclusiveBlock(editor, newBlock);
|
|
84405
|
-
}
|
|
84406
|
-
};
|
|
84407
|
-
contactWithIframe(editor, block, data2, drawioIframe, loaded, exit);
|
|
84408
|
-
const iframeUrl = getDrawioIframeUrl(editor);
|
|
84409
|
-
drawioIframe.setAttribute("src", iframeUrl);
|
|
84410
|
-
}
|
|
84411
|
-
async function initDrawIo(editor) {
|
|
84412
|
-
var _a, _b;
|
|
84413
|
-
const option = getDrawioOptions(editor);
|
|
84414
|
-
const drawIoUrl = ((_a = option.cdn) == null ? void 0 : _a.drawio) || DrawioJsUrl;
|
|
84415
|
-
const pakoUrl = ((_b = option.cdn) == null ? void 0 : _b.pako) || PakoJsUrl;
|
|
84416
|
-
await loadJsPromise(pakoUrl, "editor-pako");
|
|
84417
|
-
await loadJsPromise(drawIoUrl, "editor-drawio");
|
|
84418
|
-
}
|
|
84419
|
-
function removeDrawioEmptyStatus(embed) {
|
|
84420
|
-
removeClass(embed, DRAWIO_EMPTY_CLASS);
|
|
84421
|
-
}
|
|
84422
|
-
function addDrawioEmptyStatus(embed) {
|
|
84423
|
-
addClass(embed, DRAWIO_EMPTY_CLASS);
|
|
84424
|
-
const emptyContent = createElement("div", ["drawio-empty-content"], embed);
|
|
84425
|
-
emptyContent.innerHTML = EmptyIcon;
|
|
84426
|
-
createElement("span", ["drawio-empty-title"], emptyContent, i18n$1.t("drawio.empty"));
|
|
84427
|
-
}
|
|
84428
|
-
function addDrawioLoadErrorStatus(editor, embed, data2) {
|
|
84429
|
-
const block = getParentBlock(embed);
|
|
84430
|
-
if (!block) {
|
|
84431
|
-
return;
|
|
84432
|
-
}
|
|
84433
|
-
const blockContent = getBlockContent(block);
|
|
84434
|
-
embed.innerHTML = "";
|
|
84435
|
-
embed.style.height = "100%";
|
|
84436
|
-
addClass(block, "drawio-load-error");
|
|
84437
|
-
const errorContent = createElement("div", ["drawio-error-content"], embed);
|
|
84438
|
-
const brandIcon = createElement("div", ["drawio-error-brand-icon"], errorContent);
|
|
84439
|
-
brandIcon.innerHTML = UmlBrandIcon;
|
|
84440
|
-
createElement("div", ["drawio-error-title"], errorContent, i18n$1.t("drawio.errorTips"));
|
|
84441
|
-
const subTitle = createElement("div", ["drawio-error-sub-title"], errorContent);
|
|
84442
|
-
createElement("span", [], subTitle, i18n$1.t("drawio.errorSubTips"));
|
|
84443
|
-
const retryButton = createElement("span", ["drawio-error-retry-button"], subTitle, i18n$1.t("drawio.retry"));
|
|
84444
|
-
retryButton.onclick = () => {
|
|
84445
|
-
embed.innerHTML = "";
|
|
84446
|
-
removeClass(block, "drawio-load-error");
|
|
84447
|
-
if (data2.src) {
|
|
84448
|
-
updateGraphBySrc(data2.src, embed, editor);
|
|
84449
|
-
} else if (data2.xml) {
|
|
84450
|
-
updateGraphByXml(data2.xml, embed, editor);
|
|
84451
|
-
} else if (data2.xmlSvg) {
|
|
84452
|
-
updateGraphByXmlSvg(data2.xmlSvg, embed);
|
|
84453
|
-
}
|
|
84454
|
-
if (data2.height) {
|
|
84455
|
-
blockContent.style.height = `${data2.height}px`;
|
|
84456
|
-
embed.style.height = `${data2.height - 20}px`;
|
|
84457
|
-
}
|
|
84458
|
-
};
|
|
84459
|
-
}
|
|
84460
|
-
function setGraph(embed, data2) {
|
|
84461
|
-
assert(logger$e, data2, "Required data is missing in setGraph");
|
|
84462
|
-
if ("src" in data2) {
|
|
84463
|
-
embed.setAttribute("data-src", data2.src);
|
|
84464
|
-
return;
|
|
84465
|
-
}
|
|
84466
|
-
if ("xmlSvg" in data2) {
|
|
84467
|
-
embed.setAttribute("data-xmlsvg", data2.xmlSvg);
|
|
84468
|
-
return;
|
|
84469
|
-
}
|
|
84470
|
-
if ("graph" in data2) {
|
|
84471
|
-
const { xml, graph: graph2 } = data2;
|
|
84472
|
-
embed.graph = graph2;
|
|
84473
|
-
embed.setAttribute("data-mxfile", xml);
|
|
84474
|
-
}
|
|
84475
|
-
}
|
|
84476
|
-
function getPreGraphData(embed) {
|
|
84477
|
-
return {
|
|
84478
|
-
src: embed.getAttribute("data-src") || "",
|
|
84479
|
-
xmlSvg: embed.getAttribute("data-xmlsvg") || "",
|
|
84480
|
-
xml: embed.getAttribute("data-mxfile") || ""
|
|
84481
|
-
};
|
|
84482
|
-
}
|
|
84483
|
-
function updateGraphBySrc(src, embed, editor) {
|
|
84484
|
-
assert(logger$e, src, "params error: src");
|
|
84485
|
-
assert(logger$e, editor, "params error: editor");
|
|
84486
|
-
const embedEl = embed;
|
|
84487
|
-
const url = editor.doc.buildResourceUrl(src, {
|
|
84488
|
-
syncNewResources: async (resourceId, resourceUrl) => {
|
|
84489
|
-
var _a, _b;
|
|
84490
|
-
await editor.doc.addResources([resourceId]);
|
|
84491
|
-
const serviceAppId = (_b = (_a = editor.doc).getServerMeta) == null ? void 0 : _b.call(_a).appId;
|
|
84492
|
-
if (resourceUrl !== src && serviceAppId && src.includes(serviceAppId)) {
|
|
84493
|
-
const block = getParentBlock(embed);
|
|
84494
|
-
if (block && !editor.readonly && editor.isBlockWritable(block)) {
|
|
84495
|
-
const newBlockData = cloneDeep__default.default(editor.getBlockData(block));
|
|
84496
|
-
newBlockData.embedData.src = resourceId;
|
|
84497
|
-
editor.updateBlockData(block, newBlockData);
|
|
84498
|
-
}
|
|
84499
|
-
}
|
|
84500
|
-
}
|
|
84501
|
-
});
|
|
84502
|
-
const img = document.createElement("img");
|
|
84503
|
-
embedEl.innerHTML = "";
|
|
84504
|
-
embedEl.appendChild(img);
|
|
84505
|
-
img.src = url;
|
|
84506
|
-
img.draggable = false;
|
|
84507
|
-
setGraph(embedEl, { src });
|
|
84508
|
-
img.onload = (e2) => {
|
|
84509
|
-
const img2 = embedEl.querySelector("img");
|
|
84510
|
-
if (e2.target !== img2 || !img2) {
|
|
84511
|
-
return;
|
|
84512
|
-
}
|
|
84513
|
-
if (isEmptyImage(img2)) {
|
|
84514
|
-
addDrawioEmptyStatus(embed);
|
|
84515
|
-
} else {
|
|
84516
|
-
removeDrawioEmptyStatus(embed);
|
|
84517
|
-
}
|
|
84518
|
-
};
|
|
84519
|
-
img.onerror = (e2) => {
|
|
84520
|
-
const img2 = embedEl.querySelector("img");
|
|
84521
|
-
if (e2.target !== img2) {
|
|
84522
|
-
return;
|
|
84523
|
-
}
|
|
84524
|
-
addDrawioLoadErrorStatus(editor, embed, {
|
|
84525
|
-
src
|
|
84526
|
-
});
|
|
84527
|
-
};
|
|
84528
|
-
}
|
|
84529
|
-
function updateGraphByXml(mxFile, embed, editor) {
|
|
84530
|
-
assert(logger$e, editor, "parameter missing");
|
|
84531
|
-
initDrawIo(editor).then(() => loopCheckResourceWasLoaded({
|
|
84532
|
-
checker: () => !!(window.mxUtils && window.mxGraph && window.mxCodec),
|
|
84533
|
-
maxRetryTime: 5e3
|
|
84534
|
-
})).then(() => {
|
|
84535
|
-
const { mxUtils, mxGraph: MxGraph, mxCodec: MxCodec } = window;
|
|
84536
|
-
assert(logger$e, mxUtils, "External resource loading exception: mxUtils");
|
|
84537
|
-
assert(logger$e, MxGraph, "External resource loading exception: MxGraph");
|
|
84538
|
-
assert(logger$e, MxCodec, "External resource loading exception: MxCodec");
|
|
84539
|
-
const file2 = mxUtils.parseXml(mxFile);
|
|
84540
|
-
embed.innerHTML = "";
|
|
84541
|
-
const node = file2.documentElement;
|
|
84542
|
-
assert(logger$e, node, "Resource parsing exception");
|
|
84543
|
-
assert(logger$e, node.nodeName === "mxfile", "Resource parsing exception");
|
|
84544
|
-
const diagrams = node.getElementsByTagName("diagram");
|
|
84545
|
-
assert(logger$e, diagrams.length > 0, "Resource parsing exception");
|
|
84546
|
-
let xmlDoc;
|
|
84547
|
-
const data2 = diagrams[0];
|
|
84548
|
-
if (data2.text || data2.textContent.trim()) {
|
|
84549
|
-
const diagramBase64 = getTextContent(data2);
|
|
84550
|
-
const raw = atob(diagramBase64);
|
|
84551
|
-
const pako = window.pako;
|
|
84552
|
-
assert(logger$e, pako, "External resource loading exception: pako");
|
|
84553
|
-
const encodedXml = pako.inflateRaw(Uint8Array.from(raw, (c) => c.charCodeAt(0)), { to: "string" });
|
|
84554
|
-
const xml = decodeURIComponent(encodedXml);
|
|
84555
|
-
xmlDoc = mxUtils.parseXml(xml);
|
|
84556
|
-
} else {
|
|
84557
|
-
const xml = new XMLSerializer().serializeToString(data2.firstElementChild);
|
|
84558
|
-
xmlDoc = mxUtils.parseXml(xml);
|
|
84559
|
-
}
|
|
84560
|
-
const graph2 = new MxGraph(embed);
|
|
84561
|
-
graph2.resetViewOnRootChange = false;
|
|
84562
|
-
graph2.foldingEnabled = false;
|
|
84563
|
-
graph2.setTooltips(false);
|
|
84564
|
-
graph2.setEnabled(false);
|
|
84565
|
-
graph2.setHtmlLabels(true);
|
|
84566
|
-
const styleDoc = mxUtils.parseXml(DEFAULT_STYLES);
|
|
84567
|
-
const dec = new MxCodec(styleDoc);
|
|
84568
|
-
dec.decode(styleDoc.documentElement, graph2.getStylesheet());
|
|
84569
|
-
const codec = new MxCodec(xmlDoc);
|
|
84570
|
-
codec.decode(codec.document.documentElement, graph2.getModel());
|
|
84571
|
-
graph2.maxFitScale = 1;
|
|
84572
|
-
graph2.fit();
|
|
84573
|
-
graph2.center(true, false);
|
|
84574
|
-
setGraph(embed, { graph: graph2, xml: mxFile });
|
|
84575
|
-
}).catch((err) => {
|
|
84576
|
-
logger$e.error("Failed to Init DrawIo", err);
|
|
84577
|
-
});
|
|
84578
|
-
}
|
|
84579
|
-
function updateGraphByXmlSvg(xmlSvg, embed) {
|
|
84580
|
-
embed.innerHTML = xmlSvg;
|
|
84581
|
-
setGraph(embed, { xmlSvg });
|
|
84582
|
-
const svgElements = embed.querySelectorAll("svg");
|
|
84583
|
-
for (let i = 0; i < svgElements.length; i++) {
|
|
84584
|
-
const svg = svgElements[i];
|
|
84585
|
-
if (!isEmptySvg(svg)) {
|
|
84586
|
-
return;
|
|
84587
|
-
}
|
|
84588
|
-
}
|
|
84589
|
-
addDrawioEmptyStatus(embed);
|
|
84590
|
-
}
|
|
84591
|
-
function getBlockProperties$4(editor, block) {
|
|
84592
|
-
const properties = getStandardEmbedBlockProperties(editor, block, {
|
|
84593
|
-
handleExecuteCommand: (editor2, block2, item) => {
|
|
84594
|
-
if (item.id === "edit") {
|
|
84595
|
-
const data2 = editor2.getBlockData(block2).embedData;
|
|
84596
|
-
editGraph(editor2, block2, data2, false);
|
|
84597
|
-
return true;
|
|
84598
|
-
}
|
|
84599
|
-
if (item.id === "download") {
|
|
84600
|
-
const image = block2.querySelector(".editor-drawio-content img");
|
|
84601
|
-
if (!(image instanceof HTMLImageElement))
|
|
84602
|
-
return true;
|
|
84603
|
-
downloadImageAsPng(image.src);
|
|
84604
|
-
return true;
|
|
84605
|
-
}
|
|
84606
|
-
return false;
|
|
84607
|
-
},
|
|
84608
|
-
extCommands: (editor2, block2) => {
|
|
84609
|
-
const blockContent = getBlockContent(block2);
|
|
84610
|
-
const drawioImg = blockContent.querySelector(".editor-drawio-content img");
|
|
84611
|
-
return [{
|
|
84612
|
-
id: "download",
|
|
84613
|
-
name: i18n$1.t("common.downloadAsImage"),
|
|
84614
|
-
icon: DownloadIcon$1,
|
|
84615
|
-
states: !drawioImg ? ["disabled"] : []
|
|
84616
|
-
}];
|
|
84617
|
-
},
|
|
84618
|
-
presetIds: ["edit"],
|
|
84619
|
-
extIds: ["separator"]
|
|
84620
|
-
});
|
|
84621
|
-
return { ...properties, abstract: i18n$1.t("drawio.abstract") };
|
|
84622
|
-
}
|
|
84623
|
-
const enUS$4 = {
|
|
84624
|
-
drawio: {
|
|
84625
|
-
title: "Flowchart/UML",
|
|
84626
|
-
empty: "Empty graph",
|
|
84627
|
-
loading: "Loading",
|
|
84628
|
-
abstract: "Flowchart/UML",
|
|
84629
|
-
errorTips: "Flowchart/UML loading failed",
|
|
84630
|
-
errorSubTips: "The network service is abnormal, you can",
|
|
84631
|
-
retry: "Try again",
|
|
84632
|
-
save: "Saving"
|
|
84633
|
-
}
|
|
84634
|
-
};
|
|
84635
|
-
const zhCN$4 = {
|
|
84636
|
-
drawio: {
|
|
84637
|
-
title: "\u6D41\u7A0B\u56FE/UML",
|
|
84638
|
-
empty: "\u7A7A\u56FE\u8868",
|
|
84639
|
-
loading: "\u52A0\u8F7D\u4E2D",
|
|
84640
|
-
abstract: "\u6D41\u7A0B\u56FE/UML",
|
|
84641
|
-
errorTips: "\u6D41\u7A0B\u56FE/UML\u52A0\u8F7D\u5931\u8D25",
|
|
84642
|
-
errorSubTips: "\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5",
|
|
84643
|
-
retry: "\u91CD\u8BD5",
|
|
84644
|
-
save: "\u4FDD\u5B58\u4E2D"
|
|
84645
|
-
}
|
|
84646
|
-
};
|
|
84647
|
-
const jaJP$4 = {
|
|
84648
|
-
drawio: {
|
|
84649
|
-
title: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",
|
|
84650
|
-
empty: "\u30B0\u30E9\u30D5\u30C7\u30FC\u30BF\u306A\u3057",
|
|
84651
|
-
loading: "\u8AAD\u8FBC\u4E2D",
|
|
84652
|
-
abstract: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",
|
|
84653
|
-
errorTips: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML \u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
|
|
84654
|
-
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 ",
|
|
84655
|
-
retry: "\u518D\u8A66\u884C",
|
|
84656
|
-
save: "\u4FDD\u5B58\u4E2D"
|
|
84657
|
-
}
|
|
84658
|
-
};
|
|
84659
|
-
const langs = {
|
|
84660
|
-
"en-US": enUS$4,
|
|
84661
84877
|
"zh-CN": zhCN$4,
|
|
84878
|
+
"en-US": enUS$4,
|
|
84662
84879
|
"ja-JP": jaJP$4
|
|
84663
|
-
};
|
|
84664
|
-
|
|
84665
|
-
const logger$d = getLogger("embed-block-drawio");
|
|
84666
|
-
const isInitializationCompleted = false;
|
|
84667
|
-
function editDrawIO(editor, block, embed, data2) {
|
|
84668
|
-
assert(logger$d, embed, `parameter missing: ${embed}`);
|
|
84669
|
-
assert(logger$d, editor, `parameter missing: ${editor}`);
|
|
84670
|
-
editGraph(editor, block, data2, isInitializationCompleted);
|
|
84671
|
-
}
|
|
84672
|
-
function updateViewLayer(editor, embed, data2) {
|
|
84673
|
-
const { src, xml, xmlSvg } = data2;
|
|
84674
|
-
if (src) {
|
|
84675
|
-
updateGraphBySrc(src, embed, editor);
|
|
84676
|
-
} else if (xml) {
|
|
84677
|
-
updateGraphByXml(xml, embed, editor);
|
|
84678
|
-
} else if (xmlSvg) {
|
|
84679
|
-
updateGraphByXmlSvg(xmlSvg, embed);
|
|
84680
|
-
} else {
|
|
84681
|
-
addDrawioEmptyStatus(embed);
|
|
84682
|
-
}
|
|
84683
|
-
}
|
|
84684
|
-
function mount(editor, content, data2) {
|
|
84685
|
-
const embed = createElement("div", ["editor-drawio-content", "editor-embed"], null);
|
|
84686
|
-
content.appendChild(embed);
|
|
84687
|
-
updateViewLayer(editor, embed, data2);
|
|
84688
|
-
if (data2.height) {
|
|
84689
|
-
content.style.height = `${data2.height}px`;
|
|
84690
|
-
embed.style.height = `${data2.height - 20}px`;
|
|
84691
|
-
}
|
|
84692
|
-
}
|
|
84693
|
-
function update$1(editor, embed, data2) {
|
|
84694
|
-
const { src, xml, xmlSvg } = data2;
|
|
84695
|
-
const preDrawioData = getPreGraphData(embed);
|
|
84696
|
-
if (src !== preDrawioData.src || (xml || "") !== preDrawioData.xml || (xmlSvg || "") !== preDrawioData.xmlSvg) {
|
|
84697
|
-
updateViewLayer(editor, embed, data2);
|
|
84698
|
-
return;
|
|
84699
|
-
}
|
|
84700
|
-
const content = embed.parentElement;
|
|
84701
|
-
const block = getParentBlock(content);
|
|
84702
|
-
if (data2.height && data2.height !== Number.parseInt(content.style.height, 10)) {
|
|
84703
|
-
content.style.height = `${data2.height}px`;
|
|
84704
|
-
if (block && !block.classList.contains("drawio-load-error")) {
|
|
84705
|
-
embed.style.height = `${data2.height - 20}px`;
|
|
84706
|
-
} else {
|
|
84707
|
-
embed.style.height = "100%";
|
|
84708
|
-
}
|
|
84709
|
-
}
|
|
84710
|
-
}
|
|
84711
|
-
function createEmbedContent$4(editor, content, blockData, path, container, block) {
|
|
84712
|
-
const drawioData = blockData.embedData;
|
|
84713
|
-
mount(editor, content, drawioData);
|
|
84714
|
-
if (!clientType.isMobile) {
|
|
84715
|
-
EmbedBlockResizer.register(editor, block);
|
|
84716
|
-
}
|
|
84717
|
-
}
|
|
84718
|
-
function handleUpdateBlock$3(editor, block, blockData) {
|
|
84719
|
-
const data2 = blockData.embedData;
|
|
84720
|
-
const content = getBlockContent(block);
|
|
84721
|
-
const embed = content.querySelector(":scope > .editor-drawio-content");
|
|
84722
|
-
assert(logger$d, embed, "embed should not be null");
|
|
84723
|
-
update$1(editor, embed, data2);
|
|
84724
|
-
return true;
|
|
84725
|
-
}
|
|
84726
|
-
function getOptions$1() {
|
|
84727
|
-
return {
|
|
84728
|
-
name: "UML",
|
|
84729
|
-
insertEmbedCommandItems: [{
|
|
84730
|
-
id: "insert-drawio",
|
|
84731
|
-
name: i18n$1.t("drawio.title"),
|
|
84732
|
-
icon: UmlIcon,
|
|
84733
|
-
group: "common",
|
|
84734
|
-
order: 600,
|
|
84735
|
-
subText: getShortcutById("insert-drawio")
|
|
84736
|
-
}],
|
|
84737
|
-
handleInsertEmptyEmbed: async (editor, options) => {
|
|
84738
|
-
const embedData = {
|
|
84739
|
-
src: "",
|
|
84740
|
-
xml: "",
|
|
84741
|
-
xmlSvg: ""
|
|
84742
|
-
};
|
|
84743
|
-
const block = editor.insertEmbed(options.containerId, options.blockIndex, "drawio", embedData);
|
|
84744
|
-
setTimeout(() => {
|
|
84745
|
-
const blockContent = getBlockContent(block);
|
|
84746
|
-
const embed = blockContent.querySelector(":scope > .editor-drawio-content");
|
|
84747
|
-
assert(logger$d, embed, "embed should not be null");
|
|
84748
|
-
const blockData = editor.getBlockData(block);
|
|
84749
|
-
editDrawIO(editor, block, embed, blockData.embedData);
|
|
84750
|
-
}, 100);
|
|
84751
|
-
return block;
|
|
84752
|
-
}
|
|
84753
|
-
};
|
|
84754
|
-
}
|
|
84755
|
-
function convertTo$4(editor, blockData, doc2, type) {
|
|
84756
|
-
const { embedData } = blockData;
|
|
84757
|
-
const data2 = embedData;
|
|
84758
|
-
if (type === "html") {
|
|
84759
|
-
if (data2.src) {
|
|
84760
|
-
return `<img src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
|
|
84761
|
-
}
|
|
84762
|
-
if (data2.xmlSvg) {
|
|
84763
|
-
return data2.xmlSvg;
|
|
84764
|
-
}
|
|
84765
|
-
return "<p>[drawio]</p>";
|
|
84766
|
-
}
|
|
84767
|
-
if (type === "markdown") {
|
|
84768
|
-
if (data2.src) {
|
|
84769
|
-
return `})`;
|
|
84770
|
-
}
|
|
84771
|
-
if (data2.xmlSvg) {
|
|
84772
|
-
return data2.xmlSvg;
|
|
84773
|
-
}
|
|
84774
|
-
return "[drawio]";
|
|
84775
|
-
}
|
|
84776
|
-
return "";
|
|
84777
|
-
}
|
|
84778
|
-
const DrawioEmbed = {
|
|
84779
|
-
embedType: "drawio",
|
|
84780
|
-
getOptions: getOptions$1,
|
|
84781
|
-
createEmbedContent: createEmbedContent$4,
|
|
84782
|
-
handleUpdateBlock: handleUpdateBlock$3,
|
|
84783
|
-
getBlockProperties: getBlockProperties$4,
|
|
84784
|
-
convertTo: convertTo$4
|
|
84785
|
-
};
|
|
84786
|
-
const style = "";
|
|
84880
|
+
});
|
|
84881
|
+
const webpageStyle = "";
|
|
84787
84882
|
const index$2 = "";
|
|
84788
84883
|
const UPDATE_DELAY = 500;
|
|
84789
84884
|
const DEFAULT_EDIT_CODE_HEIGHT = 300;
|
|
@@ -88316,6 +88411,7 @@ ${data2.flowchartText}
|
|
|
88316
88411
|
editor.addCustom("list-to-mention", () => new OnesEditorBlockMention(editor));
|
|
88317
88412
|
editor.addCustom("code-caret", () => new OnesEditorCodeCaret(editor));
|
|
88318
88413
|
editor.addCustom("image-paste-handler", () => new ImagePasteHandler(editor));
|
|
88414
|
+
editor.addCustom("drawio-paste-handler", () => new DrawioPasteHandler(editor));
|
|
88319
88415
|
editor.addCustom("layout-paste-handler", () => new LayoutBlockCaptionInputHandler(editor, true));
|
|
88320
88416
|
if ((_k = options.componentsOptions) == null ? void 0 : _k.mention) {
|
|
88321
88417
|
const mentionOptions = options.componentsOptions.mention;
|
|
@@ -88375,7 +88471,7 @@ ${data2.flowchartText}
|
|
|
88375
88471
|
}
|
|
88376
88472
|
}
|
|
88377
88473
|
});
|
|
88378
|
-
editor.version = "2.2.16-beta.
|
|
88474
|
+
editor.version = "2.2.16-beta.8";
|
|
88379
88475
|
return editor;
|
|
88380
88476
|
}
|
|
88381
88477
|
function isDoc(doc2) {
|
|
@@ -88440,6 +88536,7 @@ ${data2.flowchartText}
|
|
|
88440
88536
|
} else {
|
|
88441
88537
|
editor.addCustom("mobile-helper", () => new OnesEditorMobileHelper(editor));
|
|
88442
88538
|
}
|
|
88539
|
+
editor.addCustom("drawio-paste-handler", () => new DrawioPasteHandler(editor));
|
|
88443
88540
|
editor.addCustom("image-paste-handler", () => new ImagePasteHandler(editor));
|
|
88444
88541
|
if (enableComments) {
|
|
88445
88542
|
editor.addCustom(
|
|
@@ -88469,7 +88566,7 @@ ${data2.flowchartText}
|
|
|
88469
88566
|
});
|
|
88470
88567
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
88471
88568
|
OnesEditorToolbar.register(editor);
|
|
88472
|
-
editor.version = "2.2.16-beta.
|
|
88569
|
+
editor.version = "2.2.16-beta.8";
|
|
88473
88570
|
return editor;
|
|
88474
88571
|
}
|
|
88475
88572
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -134234,6 +134331,7 @@ ${data2.flowchartText}
|
|
|
134234
134331
|
exports2.DocReAuthCallbacks = DocReAuthCallbacks;
|
|
134235
134332
|
exports2.DragDrop = DragDrop;
|
|
134236
134333
|
exports2.DrawioEmbed = DrawioEmbed;
|
|
134334
|
+
exports2.DrawioPasteHandler = DrawioPasteHandler;
|
|
134237
134335
|
exports2.EditorBlocks = EditorBlocks;
|
|
134238
134336
|
exports2.EditorBoxes = EditorBoxes;
|
|
134239
134337
|
exports2.EditorCommandProviders = EditorCommandProviders;
|