@ones-editor/editor 2.2.16-beta.5 → 2.2.16-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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: 1; /* Add a z-index if needed */
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;
@@ -7036,7 +7051,7 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
7036
7051
  }
7037
7052
  [data-command-bar-id=editor-toolbar] .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .line,
7038
7053
  .editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .line {
7039
- width: 4px;
7054
+ width: 2px;
7040
7055
  height: 16px;
7041
7056
  background-color: var(--primary-color);
7042
7057
  flex-grow: 1;
@@ -7044,8 +7059,8 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
7044
7059
  }
7045
7060
  [data-command-bar-id=editor-toolbar] .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .circle,
7046
7061
  .editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .circle {
7047
- width: 16px;
7048
- height: 16px;
7062
+ width: 8px;
7063
+ height: 8px;
7049
7064
  border-radius: 50%;
7050
7065
  flex-grow: 0;
7051
7066
  flex-shrink: 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="#F59300"/>\n</svg>\n';
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,13 +40898,29 @@ ${codeText}
40865
40898
  toast2.style.top = `${options.position.y}px`;
40866
40899
  toast2.classList.add("positioned");
40867
40900
  }
40868
- document.body.appendChild(toast2);
40869
- setTimeout(() => {
40901
+ const exit = () => {
40870
40902
  toast2.classList.remove("show");
40871
40903
  setTimeout(() => {
40872
40904
  toast2.remove();
40873
40905
  }, 500);
40874
- }, (options == null ? void 0 : options.duration) || 3e3);
40906
+ };
40907
+ toast2.onclick = (e2) => {
40908
+ var _a2;
40909
+ if ((_a2 = options == null ? void 0 : options.onClick) == null ? void 0 : _a2.call(options, e2)) {
40910
+ exit();
40911
+ }
40912
+ };
40913
+ const autoClose = (_a = options == null ? void 0 : options.autoClose) != null ? _a : true;
40914
+ if (!autoClose) {
40915
+ const icon = createElement("span", ["close"], toast2);
40916
+ icon.innerHTML = CloseIcon;
40917
+ icon.onclick = exit;
40918
+ }
40919
+ document.body.appendChild(toast2);
40920
+ if (options == null ? void 0 : options.autoClose) {
40921
+ setTimeout(() => exit(), (options == null ? void 0 : options.duration) || 3e3);
40922
+ }
40923
+ return exit;
40875
40924
  }
40876
40925
  function initMenuItem$1(item, elem) {
40877
40926
  var _a, _b;
@@ -80533,7 +80582,7 @@ ${content}
80533
80582
  "preset-1": {
80534
80583
  name: i18n$1.t("callout.command.presetAlert"),
80535
80584
  backgroundColor: 2,
80536
- icon: WarningFilledIcon
80585
+ icon: WarningFilledIcon.replaceAll('fill="currentColor"', 'fill="#F59300"')
80537
80586
  }
80538
80587
  };
80539
80588
  return presets[id];
@@ -81134,8 +81183,8 @@ ${content}
81134
81183
  },
81135
81184
  convertTo: convertTo$6
81136
81185
  };
81137
- const HANDLE_CIRCLE_SIZE = 12;
81138
- const HANDLE_WIDTH = 12;
81186
+ const HANDLE_CIRCLE_SIZE = 7;
81187
+ const HANDLE_WIDTH = 7;
81139
81188
  function createSelectHandle(type) {
81140
81189
  const container = createElement("div", ["select-handle", type], null);
81141
81190
  createElement("div", ["line"], container);
@@ -81921,6 +81970,912 @@ ${content}
81921
81970
  this.gripper.destroy();
81922
81971
  }
81923
81972
  }
81973
+ function getContentTypeFromHeaders(headers) {
81974
+ const entries = Object.entries(headers);
81975
+ for (let i = 0; i < entries.length; i++) {
81976
+ const [key, value] = entries[i];
81977
+ if (key.toLocaleLowerCase() === "content-type") {
81978
+ return value;
81979
+ }
81980
+ }
81981
+ return "";
81982
+ }
81983
+ async function downloadImageToFile(editor, src, withCredentials = true) {
81984
+ try {
81985
+ const res = await editor.doc.request(src, {
81986
+ method: "get",
81987
+ responseType: "blob",
81988
+ withCredentials
81989
+ });
81990
+ const reader = new FileReader();
81991
+ const promise = new Promise((resolve, reject) => {
81992
+ reader.onload = resolve;
81993
+ reader.onerror = reject;
81994
+ });
81995
+ reader.readAsArrayBuffer(res.data);
81996
+ await promise;
81997
+ const buffer = reader.result;
81998
+ const contentType = getContentTypeFromHeaders(res.headers).toLocaleLowerCase();
81999
+ let ext = "";
82000
+ if (contentType) {
82001
+ const extensions = mime__default.default[contentType].extensions;
82002
+ if (extensions && extensions.length > 0) {
82003
+ ext = extensions[0];
82004
+ }
82005
+ }
82006
+ const file2 = new File([buffer], `${Date.now()}.${ext}`, {
82007
+ type: contentType
82008
+ });
82009
+ return file2;
82010
+ } catch (err) {
82011
+ return null;
82012
+ }
82013
+ }
82014
+ async function downloadObjectToFile(editor, url) {
82015
+ const file2 = await downloadImageToFile(editor, url);
82016
+ return file2;
82017
+ }
82018
+ async function downloadSvgToString(editor, url) {
82019
+ const file2 = await downloadObjectToFile(editor, url);
82020
+ if (!file2)
82021
+ return null;
82022
+ const text2 = await file2.text();
82023
+ return text2;
82024
+ }
82025
+ const isEmptyImage = (svg) => {
82026
+ if (svg.naturalWidth <= 1 && svg.naturalHeight <= 1) {
82027
+ return true;
82028
+ }
82029
+ return false;
82030
+ };
82031
+ const isEmptySvg = (svg) => {
82032
+ var _a, _b;
82033
+ const widthStr = (_a = svg.getAttribute("width")) != null ? _a : "";
82034
+ const heightStr = (_b = svg.getAttribute("height")) != null ? _b : "";
82035
+ const width = Number.parseInt(widthStr, 10);
82036
+ const height = Number.parseInt(heightStr, 10);
82037
+ if (!width || !height) {
82038
+ return true;
82039
+ }
82040
+ if (width <= 1 && height <= 1) {
82041
+ return true;
82042
+ }
82043
+ return false;
82044
+ };
82045
+ const getTextContent = (node) => node != null ? node[node.textContent === void 0 ? "text" : "textContent"] : "";
82046
+ function loopCheckResourceWasLoaded(options) {
82047
+ const { checker, maxRetryTime } = options;
82048
+ const startTime = Date.now();
82049
+ return new Promise((resolve, reject) => {
82050
+ function check() {
82051
+ try {
82052
+ if (checker()) {
82053
+ resolve();
82054
+ } else if (Date.now() - startTime > maxRetryTime) {
82055
+ reject(new Error("Max retry time exceeded"));
82056
+ } else {
82057
+ setTimeout(check, 100);
82058
+ }
82059
+ } catch (error2) {
82060
+ reject(error2);
82061
+ }
82062
+ }
82063
+ check();
82064
+ });
82065
+ }
82066
+ const DrawioLang = {
82067
+ "zh-CN": "zh",
82068
+ "zh-TW": "zh-tw",
82069
+ "ja-JP": "ja",
82070
+ "en-US": "en"
82071
+ };
82072
+ const drawioIframeUrl = "https://embed.diagrams.net/?embed=1";
82073
+ const DrawioJsUrl = "https://www.draw.io/embed.js";
82074
+ const PakoJsUrl = "https://cdn.jsdelivr.net/npm/pako@2.0.3/dist/pako.es5.js";
82075
+ const EmptyIcon = '<svg width="48" height="49" viewBox="0 0 48 49" fill="none" xmlns="http://www.w3.org/2000/svg">\n<rect x="27" y="18.5" width="18" height="9" stroke="#C7C7C7" stroke-width="3"/>\n<rect x="12" y="18.5" width="9" height="9" transform="rotate(45 12 18.5)" stroke="#C7C7C7" stroke-width="3"/>\n<rect x="27" y="36.5" width="18" height="9" stroke="#C7C7C7" stroke-width="3"/>\n<path d="M27 24.5L18 24.5" stroke="#C7C7C7" stroke-width="3"/>\n<path d="M28.5 41H18" stroke="#C7C7C7" stroke-width="3"/>\n<path d="M18 41H12L12 30.5" stroke="#C7C7C7" stroke-width="3"/>\n<path d="M12 21.5L12 12.5" stroke="#C7C7C7" stroke-width="3"/>\n<rect x="7.5" y="3.5" width="9" height="9" rx="4.5" stroke="#C7C7C7" stroke-width="3"/>\n</svg>\n';
82076
+ const DEFAULT_STYLES = `
82077
+ <mxStylesheet>
82078
+ <add as="defaultVertex">
82079
+ <add as="shape" value="label"/>
82080
+ <add as="perimeter" value="rectanglePerimeter"/>
82081
+ <add as="fontSize" value="12"/>
82082
+ <add as="fontFamily" value="Helvetica"/>
82083
+ <add as="align" value="center"/>
82084
+ <add as="verticalAlign" value="middle"/>
82085
+ <add as="fillColor" value="#ffffff"/>
82086
+ <add as="strokeColor" value="#000000"/>
82087
+ <add as="fontColor" value="#000000"/>
82088
+ </add>
82089
+ <add as="defaultEdge">
82090
+ <add as="shape" value="connector"/>
82091
+ <add as="labelBackgroundColor" value="#ffffff"/>
82092
+ <add as="endArrow" value="classic"/>
82093
+ <add as="fontSize" value="11"/>
82094
+ <add as="fontFamily" value="Helvetica"/>
82095
+ <add as="align" value="center"/>
82096
+ <add as="verticalAlign" value="middle"/>
82097
+ <add as="rounded" value="1"/>
82098
+ <add as="strokeColor" value="#000000"/>
82099
+ <add as="fontColor" value="#000000"/>
82100
+ </add>
82101
+ <add as="text">
82102
+ <add as="fillColor" value="none"/>
82103
+ <add as="gradientColor" value="none"/>
82104
+ <add as="strokeColor" value="none"/>
82105
+ <add as="align" value="left"/>
82106
+ <add as="verticalAlign" value="top"/>
82107
+ </add>
82108
+ <add as="edgeLabel" extend="text">
82109
+ <add as="labelBackgroundColor" value="#ffffff"/>
82110
+ <add as="fontSize" value="11"/>
82111
+ </add>
82112
+ <add as="label">
82113
+ <add as="fontStyle" value="1"/>
82114
+ <add as="align" value="left"/>
82115
+ <add as="verticalAlign" value="middle"/>
82116
+ <add as="spacing" value="2"/>
82117
+ <add as="spacingLeft" value="52"/>
82118
+ <add as="imageWidth" value="42"/>
82119
+ <add as="imageHeight" value="42"/>
82120
+ <add as="rounded" value="1"/>
82121
+ </add>
82122
+ <add as="icon" extend="label">
82123
+ <add as="align" value="center"/>
82124
+ <add as="imageAlign" value="center"/>
82125
+ <add as="verticalLabelPosition" value="bottom"/>
82126
+ <add as="verticalAlign" value="top"/>
82127
+ <add as="spacingTop" value="4"/>
82128
+ <add as="labelBackgroundColor" value="#ffffff"/>
82129
+ <add as="spacing" value="0"/>
82130
+ <add as="spacingLeft" value="0"/>
82131
+ <add as="spacingTop" value="6"/>
82132
+ <add as="fontStyle" value="0"/>
82133
+ <add as="imageWidth" value="48"/>
82134
+ <add as="imageHeight" value="48"/>
82135
+ </add>
82136
+ <add as="swimlane">
82137
+ <add as="shape" value="swimlane"/>
82138
+ <add as="fontSize" value="12"/>
82139
+ <add as="fontStyle" value="1"/>
82140
+ <add as="startSize" value="23"/>
82141
+ </add>
82142
+ <add as="group">
82143
+ <add as="verticalAlign" value="top"/>
82144
+ <add as="fillColor" value="none"/>
82145
+ <add as="strokeColor" value="none"/>
82146
+ <add as="gradientColor" value="none"/>
82147
+ <add as="pointerEvents" value="0"/>
82148
+ </add>
82149
+ <add as="ellipse">
82150
+ <add as="shape" value="ellipse"/>
82151
+ <add as="perimeter" value="ellipsePerimeter"/>
82152
+ </add>
82153
+ <add as="rhombus">
82154
+ <add as="shape" value="rhombus"/>
82155
+ <add as="perimeter" value="rhombusPerimeter"/>
82156
+ </add>
82157
+ <add as="triangle">
82158
+ <add as="shape" value="triangle"/>
82159
+ <add as="perimeter" value="trianglePerimeter"/>
82160
+ </add>
82161
+ <add as="line">
82162
+ <add as="shape" value="line"/>
82163
+ <add as="strokeWidth" value="4"/>
82164
+ <add as="labelBackgroundColor" value="#ffffff"/>
82165
+ <add as="verticalAlign" value="top"/>
82166
+ <add as="spacingTop" value="8"/>
82167
+ </add>
82168
+ <add as="image">
82169
+ <add as="shape" value="image"/>
82170
+ <add as="labelBackgroundColor" value="white"/>
82171
+ <add as="verticalAlign" value="top"/>
82172
+ <add as="verticalLabelPosition" value="bottom"/>
82173
+ </add>
82174
+ <add as="roundImage" extend="image">
82175
+ <add as="perimeter" value="ellipsePerimeter"/>
82176
+ </add>
82177
+ <add as="rhombusImage" extend="image">
82178
+ <add as="perimeter" value="rhombusPerimeter"/>
82179
+ </add>
82180
+ <add as="arrow">
82181
+ <add as="shape" value="arrow"/>
82182
+ <add as="edgeStyle" value="none"/>
82183
+ <add as="fillColor" value="#ffffff"/>
82184
+ </add>
82185
+ </mxStylesheet>
82186
+ `;
82187
+ const toast = "";
82188
+ const showWarnToast = (exit) => {
82189
+ const errorHTML = `<span class="toast-message">${WarningFilledIcon}${i18n$1.t("drawio.errorTips")} <a>\u8FD4\u56DE\u9875\u9762</a></span>`;
82190
+ const onClick = (e2) => {
82191
+ if (e2.target instanceof HTMLAnchorElement) {
82192
+ exit();
82193
+ return true;
82194
+ }
82195
+ return false;
82196
+ };
82197
+ const hide = showToast(errorHTML, {
82198
+ autoClose: false,
82199
+ position: {
82200
+ y: 30,
82201
+ x: window.innerWidth / 2
82202
+ },
82203
+ html: true,
82204
+ onClick,
82205
+ theme: "warn"
82206
+ });
82207
+ return hide;
82208
+ };
82209
+ const BORDER = 0;
82210
+ const SAVE_DELAY_TIME = 30 * 1e3;
82211
+ const DRAWIO_EMPTY_CLASS = "editor-empty-drawio";
82212
+ const SHOW_FULL_SCREEN_IFRAME = "show-full-screen-iframe";
82213
+ const logger$j = getLogger("embed-block-drawio");
82214
+ function getDrawioOptions(editor) {
82215
+ const compOptions = editor.options.componentsOptions;
82216
+ return compOptions.drawIO || {};
82217
+ }
82218
+ function getDrawioLang(editor) {
82219
+ const options = getDrawioOptions(editor);
82220
+ const lang = options.lang;
82221
+ return lang ? DrawioLang[lang] : "";
82222
+ }
82223
+ function getDrawioIframeUrl(editor) {
82224
+ var _a;
82225
+ const options = getDrawioOptions(editor) || {};
82226
+ const iframeUrl = ((_a = options.cdn) == null ? void 0 : _a.drawioIframe) || drawioIframeUrl;
82227
+ const lang = getDrawioLang(editor);
82228
+ return updateUrl(iframeUrl, {
82229
+ spin: 1,
82230
+ proto: "json",
82231
+ configure: 1,
82232
+ lang
82233
+ });
82234
+ }
82235
+ function resizeObserver(el) {
82236
+ const resize = () => {
82237
+ assert(logger$j, el, "el does not exist");
82238
+ const width = document.body.clientWidth || document.documentElement.clientWidth;
82239
+ const height = document.body.clientHeight || document.documentElement.clientHeight;
82240
+ el.setAttribute("width", `${width - 2 * BORDER}`);
82241
+ el.setAttribute("height", `${height - 2 * BORDER}`);
82242
+ };
82243
+ const disconnect = () => {
82244
+ window.removeEventListener("resize", resize);
82245
+ };
82246
+ resize();
82247
+ window.addEventListener("resize", resize);
82248
+ return {
82249
+ disconnect
82250
+ };
82251
+ }
82252
+ async function initializeDrawioIframe(editor, block) {
82253
+ const options = getDrawioOptions(editor) || {};
82254
+ const callbacks = options.callbacks || {};
82255
+ const docReAuthCallbacks = editor.getCustom(DOC_RE_AUTH_KEYS);
82256
+ const { onCreateDrawIoFrame, onCloseDrawIoFrame } = callbacks;
82257
+ let drawioIframe = null;
82258
+ let exit;
82259
+ if (onCreateDrawIoFrame) {
82260
+ drawioIframe = await onCreateDrawIoFrame(editor);
82261
+ assert(logger$j, drawioIframe, "iframe create failed");
82262
+ exit = () => {
82263
+ assert(logger$j, drawioIframe, "iframe does not exist");
82264
+ assert(logger$j, onCloseDrawIoFrame, "missing parameters: onCloseDrawIoFrame");
82265
+ docReAuthCallbacks.removeListeners();
82266
+ onCloseDrawIoFrame(editor, drawioIframe);
82267
+ };
82268
+ } else {
82269
+ const drawioContainer = createElement("div", ["editor-drawio-iframe-container", "loading"], document.body);
82270
+ drawioContainer.setAttribute("data-placeholder", i18n$1.t("drawio.loading"));
82271
+ drawioIframe = createElement("iframe", ["drawio-iframe-element"], drawioContainer);
82272
+ drawioIframe.setAttribute("frameborder", "0");
82273
+ addClass(drawioContainer, SHOW_FULL_SCREEN_IFRAME);
82274
+ const { disconnect } = resizeObserver(drawioIframe);
82275
+ exit = () => {
82276
+ assert(logger$j, drawioIframe, "iframe does not exist");
82277
+ docReAuthCallbacks.removeListeners();
82278
+ disconnect();
82279
+ document.body.removeChild(drawioContainer);
82280
+ removeClass(drawioContainer, SHOW_FULL_SCREEN_IFRAME);
82281
+ };
82282
+ }
82283
+ docReAuthCallbacks.addAuthListen("authError", () => {
82284
+ logger$j.debug("authError! render error toolbar");
82285
+ docReAuthCallbacks.reAuthToolbar.render(block, exit);
82286
+ });
82287
+ return {
82288
+ drawioIframe,
82289
+ exit
82290
+ };
82291
+ }
82292
+ async function saveSvgToBlock(editor, block, svg, autoSave) {
82293
+ var _a, _b;
82294
+ try {
82295
+ if (autoSave) {
82296
+ logger$j.debug("auto saving drawio data");
82297
+ }
82298
+ const regex = /(<svg [^<>]* )modified=&quot;[^&]*&quot;([^<>]* )etag=&quot;[^&]*&quot;/gm;
82299
+ const subst = "$1$2";
82300
+ const normalizedSvg = svg.replace(regex, subst);
82301
+ const blob = new Blob([normalizedSvg]);
82302
+ const file2 = new File([blob], "drawio.svg", {
82303
+ type: "image/svg+xml"
82304
+ });
82305
+ const targetBlock = editor.findBlockById(getBlockId(block));
82306
+ if (targetBlock) {
82307
+ const res = await editor.doc.uploadResource(file2);
82308
+ const { resourceId } = res;
82309
+ const oldData = editor.getBlockData(targetBlock);
82310
+ const oldEmbedData = oldData.embedData;
82311
+ const newEmbedData = {
82312
+ src: resourceId,
82313
+ height: oldEmbedData == null ? void 0 : oldEmbedData.height
82314
+ };
82315
+ editor.updateEmbedData(targetBlock, newEmbedData);
82316
+ } else {
82317
+ logger$j.error("block has been deleted");
82318
+ }
82319
+ } catch (err) {
82320
+ const message = `failed to save drawio data: ${err.message}`;
82321
+ const options = getDrawioOptions(editor);
82322
+ if ((_a = options.callbacks) == null ? void 0 : _a.onError) {
82323
+ const newError = new Error(message);
82324
+ newError.code = "SaveDrawIo";
82325
+ (_b = options.callbacks) == null ? void 0 : _b.onError(editor, newError);
82326
+ }
82327
+ throw err;
82328
+ }
82329
+ }
82330
+ class LoadingHandler {
82331
+ constructor() {
82332
+ __publicField(this, "loadingContainer");
82333
+ __publicField(this, "setLoading", (iframe, placeholder2 = i18n$1.t("drawio.save")) => {
82334
+ const parent = iframe.parentElement;
82335
+ if (parent) {
82336
+ addClass(parent, "loading");
82337
+ parent.setAttribute("data-placeholder", placeholder2);
82338
+ }
82339
+ });
82340
+ __publicField(this, "removeLoading", () => {
82341
+ const containers = document.querySelectorAll(".editor-drawio-iframe-container");
82342
+ containers.forEach((r) => {
82343
+ removeClass(r, "loading");
82344
+ });
82345
+ });
82346
+ }
82347
+ }
82348
+ function contactWithIframe(editor, block, drawIoData, iframe, loaded, exit, isInitializationCompleted2) {
82349
+ let hide = () => {
82350
+ };
82351
+ const destroy = () => {
82352
+ window.removeEventListener("message", receive);
82353
+ exit();
82354
+ hide();
82355
+ };
82356
+ const loadingHandler = new LoadingHandler();
82357
+ loadingHandler.setLoading(iframe, i18n$1.t("drawio.loading"));
82358
+ let exportFlag = "auto";
82359
+ const receive = async (evt) => {
82360
+ var _a, _b;
82361
+ assert(logger$j, iframe.contentWindow, "iframe.contentWindow does not exist");
82362
+ if (evt.data.length > 0) {
82363
+ const msg = JSON.parse(evt.data);
82364
+ const xml = drawIoData.xmlSvg || drawIoData.xml;
82365
+ switch (msg.event) {
82366
+ case "configure":
82367
+ iframe.contentWindow.postMessage(JSON.stringify({
82368
+ action: "configure",
82369
+ config: {
82370
+ defaultFonts: ["Humor Sans", "Helvetica", "Times New Roman"]
82371
+ }
82372
+ }), "*");
82373
+ break;
82374
+ case "init":
82375
+ if (xml == null) {
82376
+ hide = showWarnToast(destroy);
82377
+ }
82378
+ iframe.contentWindow.postMessage(JSON.stringify({
82379
+ action: "load",
82380
+ saveAndExit: 1,
82381
+ noSaveBtn: 1,
82382
+ noExitBtn: 0,
82383
+ xml: xml || ""
82384
+ }), "*");
82385
+ loaded();
82386
+ loadingHandler.removeLoading();
82387
+ break;
82388
+ case "save":
82389
+ exportFlag = "save";
82390
+ iframe.contentWindow.postMessage(JSON.stringify({
82391
+ action: "export",
82392
+ format: "xmlsvg",
82393
+ spin: "Saving graph"
82394
+ }), "*");
82395
+ break;
82396
+ case "export":
82397
+ if (exportFlag !== "auto") {
82398
+ loadingHandler.setLoading(iframe);
82399
+ }
82400
+ const svg = fromBase64(msg.data.substring(msg.data.indexOf(",") + 1));
82401
+ try {
82402
+ await saveSvgToBlock(editor, block, svg, !!((_a = msg.message) == null ? void 0 : _a.autoSave));
82403
+ if (!((_b = msg.message) == null ? void 0 : _b.autoSave)) {
82404
+ destroy();
82405
+ }
82406
+ } catch (error2) {
82407
+ const docReAuthCallbacks = editor.getCustom(DOC_RE_AUTH_KEYS);
82408
+ docReAuthCallbacks.emit("tokenExpired");
82409
+ if (exportFlag === "save") {
82410
+ docReAuthCallbacks.reAuthToolbar.render(block, exit);
82411
+ }
82412
+ }
82413
+ loadingHandler.removeLoading();
82414
+ exportFlag = "auto";
82415
+ break;
82416
+ case "exit":
82417
+ exportFlag = "exit";
82418
+ destroy();
82419
+ break;
82420
+ }
82421
+ }
82422
+ };
82423
+ window.addEventListener("message", receive);
82424
+ }
82425
+ async function editGraph(editor, block, data2, isInitializationCompleted2) {
82426
+ if (isInitializationCompleted2) {
82427
+ return;
82428
+ }
82429
+ isInitializationCompleted2 = true;
82430
+ const options = getDrawioOptions(editor) || {};
82431
+ const { callbacks } = options;
82432
+ let autoSaveInterval;
82433
+ if (callbacks && (callbacks == null ? void 0 : callbacks.onBeginInitDrawIo)) {
82434
+ callbacks.onBeginInitDrawIo(editor, block);
82435
+ }
82436
+ const { drawioIframe, exit: exitIframe } = await initializeDrawioIframe(editor, block);
82437
+ exclusiveBlock(editor, block);
82438
+ if (data2.src) {
82439
+ const svg = await downloadSvgToString(editor, editor.doc.buildResourceUrl(data2.src));
82440
+ if (svg) {
82441
+ data2.xmlSvg = svg;
82442
+ }
82443
+ }
82444
+ const loaded = () => {
82445
+ autoSaveInterval = setInterval(() => {
82446
+ if (!drawioIframe || !drawioIframe.contentWindow) {
82447
+ return;
82448
+ }
82449
+ drawioIframe.contentWindow.postMessage(JSON.stringify({
82450
+ action: "export",
82451
+ format: "xmlsvg",
82452
+ spin: "Saving graph",
82453
+ autoSave: true
82454
+ }), "*");
82455
+ }, SAVE_DELAY_TIME);
82456
+ };
82457
+ const exit = () => {
82458
+ exitIframe();
82459
+ if (autoSaveInterval) {
82460
+ clearInterval(autoSaveInterval);
82461
+ }
82462
+ const newBlock = editor.findBlockById(getBlockId(block));
82463
+ if (newBlock) {
82464
+ unexclusiveBlock(editor, newBlock);
82465
+ }
82466
+ };
82467
+ contactWithIframe(editor, block, data2, drawioIframe, loaded, exit);
82468
+ const iframeUrl = getDrawioIframeUrl(editor);
82469
+ drawioIframe.setAttribute("src", iframeUrl);
82470
+ }
82471
+ async function initDrawIo(editor) {
82472
+ var _a, _b;
82473
+ const option = getDrawioOptions(editor);
82474
+ const drawIoUrl = ((_a = option.cdn) == null ? void 0 : _a.drawio) || DrawioJsUrl;
82475
+ const pakoUrl = ((_b = option.cdn) == null ? void 0 : _b.pako) || PakoJsUrl;
82476
+ await loadJsPromise(pakoUrl, "editor-pako");
82477
+ await loadJsPromise(drawIoUrl, "editor-drawio");
82478
+ }
82479
+ function removeDrawioEmptyStatus(embed) {
82480
+ removeClass(embed, DRAWIO_EMPTY_CLASS);
82481
+ }
82482
+ function addDrawioEmptyStatus(embed) {
82483
+ addClass(embed, DRAWIO_EMPTY_CLASS);
82484
+ const emptyContent = createElement("div", ["drawio-empty-content"], embed);
82485
+ emptyContent.innerHTML = EmptyIcon;
82486
+ createElement("span", ["drawio-empty-title"], emptyContent, i18n$1.t("drawio.empty"));
82487
+ }
82488
+ function addDrawioLoadErrorStatus(editor, embed, data2) {
82489
+ const block = getParentBlock(embed);
82490
+ if (!block) {
82491
+ return;
82492
+ }
82493
+ const blockContent = getBlockContent(block);
82494
+ embed.innerHTML = "";
82495
+ embed.style.height = "100%";
82496
+ addClass(block, "drawio-load-error");
82497
+ const errorContent = createElement("div", ["drawio-error-content"], embed);
82498
+ const brandIcon = createElement("div", ["drawio-error-brand-icon"], errorContent);
82499
+ brandIcon.innerHTML = UmlBrandIcon;
82500
+ createElement("div", ["drawio-error-title"], errorContent, i18n$1.t("drawio.errorTips"));
82501
+ const subTitle = createElement("div", ["drawio-error-sub-title"], errorContent);
82502
+ createElement("span", [], subTitle, i18n$1.t("drawio.errorSubTips"));
82503
+ const retryButton = createElement("span", ["drawio-error-retry-button"], subTitle, i18n$1.t("drawio.retry"));
82504
+ retryButton.onclick = () => {
82505
+ embed.innerHTML = "";
82506
+ removeClass(block, "drawio-load-error");
82507
+ if (data2.src) {
82508
+ updateGraphBySrc(data2.src, embed, editor);
82509
+ } else if (data2.xml) {
82510
+ updateGraphByXml(data2.xml, embed, editor);
82511
+ } else if (data2.xmlSvg) {
82512
+ updateGraphByXmlSvg(data2.xmlSvg, embed);
82513
+ }
82514
+ if (data2.height) {
82515
+ blockContent.style.height = `${data2.height}px`;
82516
+ embed.style.height = `${data2.height - 20}px`;
82517
+ }
82518
+ };
82519
+ }
82520
+ function setGraph(embed, data2) {
82521
+ assert(logger$j, data2, "Required data is missing in setGraph");
82522
+ if ("src" in data2) {
82523
+ embed.setAttribute("data-src", data2.src);
82524
+ return;
82525
+ }
82526
+ if ("xmlSvg" in data2) {
82527
+ embed.setAttribute("data-xmlsvg", data2.xmlSvg);
82528
+ return;
82529
+ }
82530
+ if ("graph" in data2) {
82531
+ const { xml, graph: graph2 } = data2;
82532
+ embed.graph = graph2;
82533
+ embed.setAttribute("data-mxfile", xml);
82534
+ }
82535
+ }
82536
+ function getPreGraphData(embed) {
82537
+ return {
82538
+ src: embed.getAttribute("data-src") || "",
82539
+ xmlSvg: embed.getAttribute("data-xmlsvg") || "",
82540
+ xml: embed.getAttribute("data-mxfile") || ""
82541
+ };
82542
+ }
82543
+ function updateGraphBySrc(src, embed, editor) {
82544
+ assert(logger$j, src, "params error: src");
82545
+ assert(logger$j, editor, "params error: editor");
82546
+ const embedEl = embed;
82547
+ const url = editor.doc.buildResourceUrl(src, {
82548
+ syncNewResources: async (resourceId, resourceUrl) => {
82549
+ var _a, _b;
82550
+ await editor.doc.addResources([resourceId]);
82551
+ const serviceAppId = (_b = (_a = editor.doc).getServerMeta) == null ? void 0 : _b.call(_a).appId;
82552
+ if (resourceUrl !== src && serviceAppId && src.includes(serviceAppId)) {
82553
+ const block = getParentBlock(embed);
82554
+ if (block && !editor.readonly && editor.isBlockWritable(block)) {
82555
+ const newBlockData = cloneDeep__default.default(editor.getBlockData(block));
82556
+ newBlockData.embedData.src = resourceId;
82557
+ editor.updateBlockData(block, newBlockData);
82558
+ }
82559
+ }
82560
+ }
82561
+ });
82562
+ const img = document.createElement("img");
82563
+ embedEl.innerHTML = "";
82564
+ embedEl.appendChild(img);
82565
+ img.src = url;
82566
+ img.draggable = false;
82567
+ setGraph(embedEl, { src });
82568
+ img.onload = (e2) => {
82569
+ const img2 = embedEl.querySelector("img");
82570
+ if (e2.target !== img2 || !img2) {
82571
+ return;
82572
+ }
82573
+ if (isEmptyImage(img2)) {
82574
+ addDrawioEmptyStatus(embed);
82575
+ } else {
82576
+ removeDrawioEmptyStatus(embed);
82577
+ }
82578
+ };
82579
+ img.onerror = (e2) => {
82580
+ const img2 = embedEl.querySelector("img");
82581
+ if (e2.target !== img2) {
82582
+ return;
82583
+ }
82584
+ addDrawioLoadErrorStatus(editor, embed, {
82585
+ src
82586
+ });
82587
+ };
82588
+ }
82589
+ function updateGraphByXml(mxFile, embed, editor) {
82590
+ assert(logger$j, editor, "parameter missing");
82591
+ initDrawIo(editor).then(() => loopCheckResourceWasLoaded({
82592
+ checker: () => !!(window.mxUtils && window.mxGraph && window.mxCodec),
82593
+ maxRetryTime: 5e3
82594
+ })).then(() => {
82595
+ const { mxUtils, mxGraph: MxGraph, mxCodec: MxCodec } = window;
82596
+ assert(logger$j, mxUtils, "External resource loading exception: mxUtils");
82597
+ assert(logger$j, MxGraph, "External resource loading exception: MxGraph");
82598
+ assert(logger$j, MxCodec, "External resource loading exception: MxCodec");
82599
+ const file2 = mxUtils.parseXml(mxFile);
82600
+ embed.innerHTML = "";
82601
+ const node = file2.documentElement;
82602
+ assert(logger$j, node, "Resource parsing exception");
82603
+ assert(logger$j, node.nodeName === "mxfile", "Resource parsing exception");
82604
+ const diagrams = node.getElementsByTagName("diagram");
82605
+ assert(logger$j, diagrams.length > 0, "Resource parsing exception");
82606
+ let xmlDoc;
82607
+ const data2 = diagrams[0];
82608
+ if (data2.text || data2.textContent.trim()) {
82609
+ const diagramBase64 = getTextContent(data2);
82610
+ const raw = atob(diagramBase64);
82611
+ const pako = window.pako;
82612
+ assert(logger$j, pako, "External resource loading exception: pako");
82613
+ const encodedXml = pako.inflateRaw(Uint8Array.from(raw, (c) => c.charCodeAt(0)), { to: "string" });
82614
+ const xml = decodeURIComponent(encodedXml);
82615
+ xmlDoc = mxUtils.parseXml(xml);
82616
+ } else {
82617
+ const xml = new XMLSerializer().serializeToString(data2.firstElementChild);
82618
+ xmlDoc = mxUtils.parseXml(xml);
82619
+ }
82620
+ const graph2 = new MxGraph(embed);
82621
+ graph2.resetViewOnRootChange = false;
82622
+ graph2.foldingEnabled = false;
82623
+ graph2.setTooltips(false);
82624
+ graph2.setEnabled(false);
82625
+ graph2.setHtmlLabels(true);
82626
+ const styleDoc = mxUtils.parseXml(DEFAULT_STYLES);
82627
+ const dec = new MxCodec(styleDoc);
82628
+ dec.decode(styleDoc.documentElement, graph2.getStylesheet());
82629
+ const codec = new MxCodec(xmlDoc);
82630
+ codec.decode(codec.document.documentElement, graph2.getModel());
82631
+ graph2.maxFitScale = 1;
82632
+ graph2.fit();
82633
+ graph2.center(true, false);
82634
+ setGraph(embed, { graph: graph2, xml: mxFile });
82635
+ }).catch((err) => {
82636
+ logger$j.error("Failed to Init DrawIo", err);
82637
+ });
82638
+ }
82639
+ function updateGraphByXmlSvg(xmlSvg, embed) {
82640
+ embed.innerHTML = xmlSvg;
82641
+ setGraph(embed, { xmlSvg });
82642
+ const svgElements = embed.querySelectorAll("svg");
82643
+ for (let i = 0; i < svgElements.length; i++) {
82644
+ const svg = svgElements[i];
82645
+ if (!isEmptySvg(svg)) {
82646
+ return;
82647
+ }
82648
+ }
82649
+ addDrawioEmptyStatus(embed);
82650
+ }
82651
+ function getBlockProperties$5(editor, block) {
82652
+ const properties = getStandardEmbedBlockProperties(editor, block, {
82653
+ handleExecuteCommand: (editor2, block2, item) => {
82654
+ if (item.id === "edit") {
82655
+ const data2 = editor2.getBlockData(block2).embedData;
82656
+ editGraph(editor2, block2, data2, false);
82657
+ return true;
82658
+ }
82659
+ if (item.id === "download") {
82660
+ const image = block2.querySelector(".editor-drawio-content img");
82661
+ if (!(image instanceof HTMLImageElement))
82662
+ return true;
82663
+ downloadImageAsPng(image.src);
82664
+ return true;
82665
+ }
82666
+ return false;
82667
+ },
82668
+ extCommands: (editor2, block2) => {
82669
+ const blockContent = getBlockContent(block2);
82670
+ const drawioImg = blockContent.querySelector(".editor-drawio-content img");
82671
+ return [{
82672
+ id: "download",
82673
+ name: i18n$1.t("common.downloadAsImage"),
82674
+ icon: DownloadIcon$1,
82675
+ states: !drawioImg ? ["disabled"] : []
82676
+ }];
82677
+ },
82678
+ presetIds: ["edit"],
82679
+ extIds: ["separator"]
82680
+ });
82681
+ return { ...properties, abstract: i18n$1.t("drawio.abstract") };
82682
+ }
82683
+ const enUS$6 = {
82684
+ drawio: {
82685
+ title: "Flowchart/UML",
82686
+ empty: "Empty graph",
82687
+ loading: "Loading",
82688
+ abstract: "Flowchart/UML",
82689
+ errorTips: "Flowchart/UML loading failed",
82690
+ errorSubTips: "The network service is abnormal, you can",
82691
+ retry: "Try again",
82692
+ save: "Saving"
82693
+ }
82694
+ };
82695
+ const zhCN$6 = {
82696
+ drawio: {
82697
+ title: "\u6D41\u7A0B\u56FE/UML",
82698
+ empty: "\u7A7A\u56FE\u8868",
82699
+ loading: "\u52A0\u8F7D\u4E2D",
82700
+ abstract: "\u6D41\u7A0B\u56FE/UML",
82701
+ errorTips: "\u6D41\u7A0B\u56FE/UML\u52A0\u8F7D\u5931\u8D25",
82702
+ errorSubTips: "\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5",
82703
+ retry: "\u91CD\u8BD5",
82704
+ save: "\u4FDD\u5B58\u4E2D"
82705
+ }
82706
+ };
82707
+ const jaJP$6 = {
82708
+ drawio: {
82709
+ title: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",
82710
+ empty: "\u30B0\u30E9\u30D5\u30C7\u30FC\u30BF\u306A\u3057",
82711
+ loading: "\u8AAD\u8FBC\u4E2D",
82712
+ abstract: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",
82713
+ errorTips: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML \u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
82714
+ 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 ",
82715
+ retry: "\u518D\u8A66\u884C",
82716
+ save: "\u4FDD\u5B58\u4E2D"
82717
+ }
82718
+ };
82719
+ const langs = {
82720
+ "en-US": enUS$6,
82721
+ "zh-CN": zhCN$6,
82722
+ "ja-JP": jaJP$6
82723
+ };
82724
+ i18n$1.mergeLang(langs);
82725
+ const logger$i = getLogger("embed-block-drawio");
82726
+ const isInitializationCompleted = false;
82727
+ function editDrawIO(editor, block, embed, data2) {
82728
+ assert(logger$i, embed, `parameter missing: ${embed}`);
82729
+ assert(logger$i, editor, `parameter missing: ${editor}`);
82730
+ editGraph(editor, block, data2, isInitializationCompleted);
82731
+ }
82732
+ function updateViewLayer(editor, embed, data2) {
82733
+ const { src, xml, xmlSvg } = data2;
82734
+ if (src) {
82735
+ updateGraphBySrc(src, embed, editor);
82736
+ } else if (xml) {
82737
+ updateGraphByXml(xml, embed, editor);
82738
+ } else if (xmlSvg) {
82739
+ updateGraphByXmlSvg(xmlSvg, embed);
82740
+ } else {
82741
+ addDrawioEmptyStatus(embed);
82742
+ }
82743
+ }
82744
+ function mount(editor, content, data2) {
82745
+ const embed = createElement("div", ["editor-drawio-content", "editor-embed"], null);
82746
+ content.appendChild(embed);
82747
+ updateViewLayer(editor, embed, data2);
82748
+ if (data2.height) {
82749
+ content.style.height = `${data2.height}px`;
82750
+ embed.style.height = `${data2.height - 20}px`;
82751
+ }
82752
+ }
82753
+ function update$1(editor, embed, data2) {
82754
+ const { src, xml, xmlSvg } = data2;
82755
+ const preDrawioData = getPreGraphData(embed);
82756
+ if (src !== preDrawioData.src || (xml || "") !== preDrawioData.xml || (xmlSvg || "") !== preDrawioData.xmlSvg) {
82757
+ updateViewLayer(editor, embed, data2);
82758
+ return;
82759
+ }
82760
+ const content = embed.parentElement;
82761
+ const block = getParentBlock(content);
82762
+ if (data2.height && data2.height !== Number.parseInt(content.style.height, 10)) {
82763
+ content.style.height = `${data2.height}px`;
82764
+ if (block && !block.classList.contains("drawio-load-error")) {
82765
+ embed.style.height = `${data2.height - 20}px`;
82766
+ } else {
82767
+ embed.style.height = "100%";
82768
+ }
82769
+ }
82770
+ }
82771
+ function createEmbedContent$5(editor, content, blockData, path, container, block) {
82772
+ const drawioData = blockData.embedData;
82773
+ mount(editor, content, drawioData);
82774
+ if (!clientType.isMobile) {
82775
+ EmbedBlockResizer.register(editor, block);
82776
+ }
82777
+ }
82778
+ function handleUpdateBlock$4(editor, block, blockData) {
82779
+ const data2 = blockData.embedData;
82780
+ const content = getBlockContent(block);
82781
+ const embed = content.querySelector(":scope > .editor-drawio-content");
82782
+ assert(logger$i, embed, "embed should not be null");
82783
+ update$1(editor, embed, data2);
82784
+ return true;
82785
+ }
82786
+ function getOptions$3() {
82787
+ return {
82788
+ name: "UML",
82789
+ insertEmbedCommandItems: [{
82790
+ id: "insert-drawio",
82791
+ name: i18n$1.t("drawio.title"),
82792
+ icon: UmlIcon,
82793
+ group: "common",
82794
+ order: 600,
82795
+ subText: getShortcutById("insert-drawio")
82796
+ }],
82797
+ handleInsertEmptyEmbed: async (editor, options) => {
82798
+ const embedData = {
82799
+ src: "",
82800
+ xml: "",
82801
+ xmlSvg: ""
82802
+ };
82803
+ const block = editor.insertEmbed(options.containerId, options.blockIndex, "drawio", embedData);
82804
+ setTimeout(() => {
82805
+ const blockContent = getBlockContent(block);
82806
+ const embed = blockContent.querySelector(":scope > .editor-drawio-content");
82807
+ assert(logger$i, embed, "embed should not be null");
82808
+ const blockData = editor.getBlockData(block);
82809
+ editDrawIO(editor, block, embed, blockData.embedData);
82810
+ }, 100);
82811
+ return block;
82812
+ }
82813
+ };
82814
+ }
82815
+ function convertTo$5(editor, blockData, doc2, type) {
82816
+ const { embedData } = blockData;
82817
+ const data2 = embedData;
82818
+ if (type === "html") {
82819
+ if (data2.src) {
82820
+ return `<img src="${editor.doc.buildResourceUrl(data2.src, { withToken: true })}" />`;
82821
+ }
82822
+ if (data2.xmlSvg) {
82823
+ return data2.xmlSvg;
82824
+ }
82825
+ return "<p>[drawio]</p>";
82826
+ }
82827
+ if (type === "markdown") {
82828
+ if (data2.src) {
82829
+ return `![drawio](${editor.doc.buildResourceUrl(data2.src, { withToken: true })})`;
82830
+ }
82831
+ if (data2.xmlSvg) {
82832
+ return data2.xmlSvg;
82833
+ }
82834
+ return "[drawio]";
82835
+ }
82836
+ return "";
82837
+ }
82838
+ const DrawioEmbed = {
82839
+ embedType: "drawio",
82840
+ getOptions: getOptions$3,
82841
+ createEmbedContent: createEmbedContent$5,
82842
+ handleUpdateBlock: handleUpdateBlock$4,
82843
+ getBlockProperties: getBlockProperties$5,
82844
+ convertTo: convertTo$5
82845
+ };
82846
+ class DrawioPasteHandler {
82847
+ constructor(editor) {
82848
+ __publicField(this, "handleBeforePasteDoc", async (editor, doc2) => {
82849
+ Object.values(doc2.blocks).forEach((blocks) => {
82850
+ var _a;
82851
+ for (let i = blocks.length - 1; i >= 0; i -= 1) {
82852
+ const block = blocks[i];
82853
+ if (block.type === "embed" && block.embedType === "drawio") {
82854
+ const src = ((_a = block.embedData) == null ? void 0 : _a.src) || "";
82855
+ if (!this.isSameOrigin(editor, doc2, src)) {
82856
+ blocks.splice(i, 1);
82857
+ }
82858
+ }
82859
+ }
82860
+ });
82861
+ return false;
82862
+ });
82863
+ this.editor = editor;
82864
+ setTimeout(() => {
82865
+ this.editor.input.addHandler(this);
82866
+ });
82867
+ }
82868
+ isSameOrigin(editor, doc2, src) {
82869
+ var _a, _b;
82870
+ const apiServer = ((_b = (_a = editor.doc).getServerMeta) == null ? void 0 : _b.call(_a).apiServer) || window.location.origin;
82871
+ const origin = new URL(apiServer).origin;
82872
+ const docServer = src.startsWith("http") ? src : doc2.meta.apiServer;
82873
+ return (docServer == null ? void 0 : docServer.startsWith(origin)) || false;
82874
+ }
82875
+ destroy() {
82876
+ }
82877
+ }
82878
+ const style = "";
81924
82879
  function getChildContainers(editor, block, from, to) {
81925
82880
  const contents = Array.from(
81926
82881
  block.querySelectorAll(':scope > .layout-root > [data-type="editor-container"].child')
@@ -81938,7 +82893,7 @@ ${content}
81938
82893
  );
81939
82894
  return contents;
81940
82895
  }
81941
- const zhCN$6 = {
82896
+ const zhCN$5 = {
81942
82897
  layout: {
81943
82898
  title: "\u5206\u680F",
81944
82899
  columnDrag: "\u957F\u6309\u62D6\u62FD\n\u70B9\u51FB\u53EF\u64CD\u4F5C\u5220\u9664",
@@ -81947,7 +82902,7 @@ ${content}
81947
82902
  currentCols: "{currentColumns} \u680F"
81948
82903
  }
81949
82904
  };
81950
- const enUS$6 = {
82905
+ const enUS$5 = {
81951
82906
  layout: {
81952
82907
  title: "Column",
81953
82908
  columnDrag: "Click and hold the column to drag it.\nClick to delete it.",
@@ -81956,7 +82911,7 @@ ${content}
81956
82911
  currentCols: "{currentColumns} columns"
81957
82912
  }
81958
82913
  };
81959
- const jaJP$6 = {
82914
+ const jaJP$5 = {
81960
82915
  layout: {
81961
82916
  title: "\u6BB5\u7D44\u307F",
81962
82917
  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 +82921,9 @@ ${content}
81966
82921
  }
81967
82922
  };
81968
82923
  i18n$1.mergeLang({
81969
- "zh-CN": zhCN$6,
81970
- "en-US": enUS$6,
81971
- "ja-JP": jaJP$6
82924
+ "zh-CN": zhCN$5,
82925
+ "en-US": enUS$5,
82926
+ "ja-JP": jaJP$5
81972
82927
  });
81973
82928
  const layoutStyles = "";
81974
82929
  const LAYOUT_NAME = "LayoutBlock";
@@ -82307,7 +83262,7 @@ ${content}
82307
83262
  }
82308
83263
  return void 0;
82309
83264
  };
82310
- const logger$j = getLogger("table-creator");
83265
+ const logger$h = getLogger("table-creator");
82311
83266
  class LayoutCreatorItem {
82312
83267
  constructor() {
82313
83268
  __publicField(this, "id", "insert-layout");
@@ -82332,7 +83287,7 @@ ${content}
82332
83287
  event.preventDefault();
82333
83288
  event.stopPropagation();
82334
83289
  const target = event.target;
82335
- assert(logger$j, target instanceof HTMLElement, "invalid event target");
83290
+ assert(logger$h, target instanceof HTMLElement, "invalid event target");
82336
83291
  if (!this.colCount || this.colCount < 2) {
82337
83292
  return;
82338
83293
  }
@@ -82349,9 +83304,9 @@ ${content}
82349
83304
  });
82350
83305
  __publicField(this, "handleLayoutCreatorColumnEnter", (event) => {
82351
83306
  const target = event.target;
82352
- assert(logger$j, target instanceof HTMLElement, "invalid event target");
83307
+ assert(logger$h, target instanceof HTMLElement, "invalid event target");
82353
83308
  const id = target.id;
82354
- assert(logger$j, id.startsWith(this.classPrefix.column), "invalid cell id");
83309
+ assert(logger$h, id.startsWith(this.classPrefix.column), "invalid cell id");
82355
83310
  const col = id.substring(this.classPrefix.column.length);
82356
83311
  const colIndex = Number.parseInt(col, 10);
82357
83312
  this.colCount = colIndex + 1;
@@ -82538,7 +83493,7 @@ ${content}
82538
83493
  headingCollapsable: true,
82539
83494
  previewNoShadow: true
82540
83495
  });
82541
- const logger$i = getLogger("layout-block");
83496
+ const logger$g = getLogger("layout-block");
82542
83497
  const updateSelection = (editor, block, from, to) => {
82543
83498
  var _a;
82544
83499
  const childrenIds = (_a = editor.getBlockData(block).children) != null ? _a : [];
@@ -82553,8 +83508,8 @@ ${content}
82553
83508
  });
82554
83509
  };
82555
83510
  const getSelectedContainers = (editor, complexBlock, start, end) => {
82556
- assert(logger$i, start.blockId === end.blockId, "Start and end block must be the same");
82557
- assert(logger$i, start.blockId === complexBlock.id, "Start block must be the same as complex block");
83511
+ assert(logger$g, start.blockId === end.blockId, "Start and end block must be the same");
83512
+ assert(logger$g, start.blockId === complexBlock.id, "Start block must be the same as complex block");
82558
83513
  return getChildContainers(editor, complexBlock, start.childContainerId, end.childContainerId);
82559
83514
  };
82560
83515
  const getTextToolbarReferenceClient = (editor, block) => {
@@ -83288,7 +84243,7 @@ ${content}
83288
84243
  }
83289
84244
  return null;
83290
84245
  };
83291
- const getOptions$3 = (editor) => getLayoutOptions();
84246
+ const getOptions$2 = (editor) => getLayoutOptions();
83292
84247
  const LayoutBlock = {
83293
84248
  blockType: LAYOUT_BLOCK_TYPE,
83294
84249
  blockKind: "complex",
@@ -83308,7 +84263,7 @@ ${content}
83308
84263
  getChildContainers: (editor, block) => getChildContainers(editor, block),
83309
84264
  getNextContainer,
83310
84265
  getSelectedContainers,
83311
- getOptions: getOptions$3,
84266
+ getOptions: getOptions$2,
83312
84267
  handleDrop,
83313
84268
  handleDropOver,
83314
84269
  getTextToolbarReferenceClient,
@@ -83339,7 +84294,7 @@ ${content}
83339
84294
  }
83340
84295
  };
83341
84296
  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$h = getLogger("webpage");
84297
+ const logger$f = getLogger("webpage");
83343
84298
  class WebPage {
83344
84299
  constructor(editor, blockData) {
83345
84300
  __publicField(this, "currentSrc", "");
@@ -83381,7 +84336,7 @@ ${content}
83381
84336
  const iframe = createElement("iframe", ["editor-preview-iframe"], internalContainer);
83382
84337
  this.loading = this.createLoading(internalContainer);
83383
84338
  const handleIframeLoaded = () => {
83384
- assert(logger$h, this.loading, "not created");
84339
+ assert(logger$f, this.loading, "not created");
83385
84340
  this.loading.hide();
83386
84341
  this.currentSrc = src;
83387
84342
  };
@@ -83393,12 +84348,12 @@ ${content}
83393
84348
  this.createMask(editor, block);
83394
84349
  }
83395
84350
  update(editor, block, embedData) {
83396
- assert(logger$h, this.loading, "not created");
84351
+ assert(logger$f, this.loading, "not created");
83397
84352
  if (this.currentSrc === embedData.src) {
83398
84353
  return;
83399
84354
  }
83400
84355
  const iframe = block.querySelector(".editor-preview-iframe");
83401
- assert(logger$h, iframe, "no exists iframe");
84356
+ assert(logger$f, iframe, "no exists iframe");
83402
84357
  this.loading.show();
83403
84358
  iframe.src = embedData.src;
83404
84359
  this.createMask(editor, block);
@@ -83514,7 +84469,7 @@ ${content}
83514
84469
  }
83515
84470
  }
83516
84471
  const index$3 = "";
83517
- const logger$g = getLogger("editor-dialog");
84472
+ const logger$e = getLogger("editor-dialog");
83518
84473
  function createContainer(content, options) {
83519
84474
  const container = createElement("div", ["editor-dialog-container"], null);
83520
84475
  const header = createElement("div", ["dialog-header"], container);
@@ -83538,7 +84493,7 @@ ${content}
83538
84493
  const y = document.documentElement.clientHeight / 2;
83539
84494
  const x = document.documentElement.clientWidth / 2;
83540
84495
  const rootElement = this.getCommandBarRoot();
83541
- assert(logger$g, rootElement, "no command bar root");
84496
+ assert(logger$e, rootElement, "no command bar root");
83542
84497
  const { width, height } = rootElement.getBoundingClientRect();
83543
84498
  return new DOMRect(Math.max(x - width / 2, 0), Math.max(y - height / 2, 0), 0, 0);
83544
84499
  });
@@ -83773,7 +84728,7 @@ ${content}
83773
84728
  window.open(src, "_blank");
83774
84729
  return true;
83775
84730
  }
83776
- function getBlockProperties$5(editor, block) {
84731
+ function getBlockProperties$4(editor, block) {
83777
84732
  const properties = getStandardEmbedBlockProperties(editor, block, {
83778
84733
  presetIds: [],
83779
84734
  extCommands: editor.readonly ? [] : [{
@@ -83801,12 +84756,12 @@ ${content}
83801
84756
  abstract
83802
84757
  };
83803
84758
  }
83804
- const logger$f = getLogger("webpage-embed");
83805
- function createEmbedContent$5(editor, content, blockData, path, container, block) {
84759
+ const logger$d = getLogger("webpage-embed");
84760
+ function createEmbedContent$4(editor, content, blockData, path, container, block) {
83806
84761
  const { embedData, id } = blockData;
83807
84762
  const { src } = embedData;
83808
84763
  const webpage = editor.addCustom(`webpage-${id}`, () => new WebPage(editor, blockData));
83809
- assert(logger$f, src, "The src from blockData is invalid ");
84764
+ assert(logger$d, src, "The src from blockData is invalid ");
83810
84765
  webpage.create(editor, embedData, content, block);
83811
84766
  setTimeout(() => {
83812
84767
  if (editor.isBlockWritable(block) && !clientType.isMobile) {
@@ -83817,7 +84772,7 @@ ${content}
83817
84772
  block.style.height = `${blockData.height}px`;
83818
84773
  }
83819
84774
  }
83820
- function handleUpdateBlock$4(editor, block, blockData) {
84775
+ function handleUpdateBlock$3(editor, block, blockData) {
83821
84776
  const { embedData, id } = blockData;
83822
84777
  const webpage = editor.getCustom(`webpage-${id}`);
83823
84778
  webpage.update(editor, block, embedData);
@@ -83826,14 +84781,14 @@ ${content}
83826
84781
  }
83827
84782
  return true;
83828
84783
  }
83829
- function getOptions$2(editor) {
84784
+ function getOptions$1(editor) {
83830
84785
  return {
83831
84786
  name: "WebPage",
83832
84787
  insertEmbedCommandItems: getAllowedWebPages(editor),
83833
84788
  handleInsertEmptyEmbed
83834
84789
  };
83835
84790
  }
83836
- function convertTo$5(editor, blockData, doc2, type) {
84791
+ function convertTo$4(editor, blockData, doc2, type) {
83837
84792
  const webpage = blockData.embedData;
83838
84793
  const url = webpage.src;
83839
84794
  if (type === "html") {
@@ -83846,13 +84801,13 @@ ${content}
83846
84801
  }
83847
84802
  const WebPageEmbed = {
83848
84803
  embedType: "webpage",
83849
- createEmbedContent: createEmbedContent$5,
83850
- getBlockProperties: getBlockProperties$5,
83851
- getOptions: getOptions$2,
83852
- handleUpdateBlock: handleUpdateBlock$4,
83853
- convertTo: convertTo$5
84804
+ createEmbedContent: createEmbedContent$4,
84805
+ getBlockProperties: getBlockProperties$4,
84806
+ getOptions: getOptions$1,
84807
+ handleUpdateBlock: handleUpdateBlock$3,
84808
+ convertTo: convertTo$4
83854
84809
  };
83855
- const zhCN$5 = {
84810
+ const zhCN$4 = {
83856
84811
  webpage: {
83857
84812
  title: "\u7F51\u9875",
83858
84813
  youku: "\u4F18\u9177\u89C6\u9891",
@@ -83878,7 +84833,7 @@ ${content}
83878
84833
  }
83879
84834
  }
83880
84835
  };
83881
- const enUS$5 = {
84836
+ const enUS$4 = {
83882
84837
  webpage: {
83883
84838
  title: "Webpage",
83884
84839
  youku: "Youku",
@@ -83904,7 +84859,7 @@ ${content}
83904
84859
  }
83905
84860
  }
83906
84861
  };
83907
- const jaJP$5 = {
84862
+ const jaJP$4 = {
83908
84863
  webpage: {
83909
84864
  title: "Web \u30DA\u30FC\u30B8",
83910
84865
  youku: "Youku \u52D5\u753B",
@@ -83931,859 +84886,11 @@ ${content}
83931
84886
  }
83932
84887
  };
83933
84888
  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=&quot;[^&]*&quot;([^<>]* )etag=&quot;[^&]*&quot;/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
84889
  "zh-CN": zhCN$4,
84890
+ "en-US": enUS$4,
84662
84891
  "ja-JP": jaJP$4
84663
- };
84664
- i18n$1.mergeLang(langs);
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 `![drawio](${editor.doc.buildResourceUrl(data2.src, { withToken: true })})`;
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 = "";
84892
+ });
84893
+ const webpageStyle = "";
84787
84894
  const index$2 = "";
84788
84895
  const UPDATE_DELAY = 500;
84789
84896
  const DEFAULT_EDIT_CODE_HEIGHT = 300;
@@ -88316,6 +88423,7 @@ ${data2.flowchartText}
88316
88423
  editor.addCustom("list-to-mention", () => new OnesEditorBlockMention(editor));
88317
88424
  editor.addCustom("code-caret", () => new OnesEditorCodeCaret(editor));
88318
88425
  editor.addCustom("image-paste-handler", () => new ImagePasteHandler(editor));
88426
+ editor.addCustom("drawio-paste-handler", () => new DrawioPasteHandler(editor));
88319
88427
  editor.addCustom("layout-paste-handler", () => new LayoutBlockCaptionInputHandler(editor, true));
88320
88428
  if ((_k = options.componentsOptions) == null ? void 0 : _k.mention) {
88321
88429
  const mentionOptions = options.componentsOptions.mention;
@@ -88375,7 +88483,7 @@ ${data2.flowchartText}
88375
88483
  }
88376
88484
  }
88377
88485
  });
88378
- editor.version = "2.2.16-beta.5";
88486
+ editor.version = "2.2.16-beta.7";
88379
88487
  return editor;
88380
88488
  }
88381
88489
  function isDoc(doc2) {
@@ -88440,6 +88548,7 @@ ${data2.flowchartText}
88440
88548
  } else {
88441
88549
  editor.addCustom("mobile-helper", () => new OnesEditorMobileHelper(editor));
88442
88550
  }
88551
+ editor.addCustom("drawio-paste-handler", () => new DrawioPasteHandler(editor));
88443
88552
  editor.addCustom("image-paste-handler", () => new ImagePasteHandler(editor));
88444
88553
  if (enableComments) {
88445
88554
  editor.addCustom(
@@ -88469,7 +88578,7 @@ ${data2.flowchartText}
88469
88578
  });
88470
88579
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
88471
88580
  OnesEditorToolbar.register(editor);
88472
- editor.version = "2.2.16-beta.5";
88581
+ editor.version = "2.2.16-beta.7";
88473
88582
  return editor;
88474
88583
  }
88475
88584
  async function showDocVersions(editor, options, serverUrl) {
@@ -134234,6 +134343,7 @@ ${data2.flowchartText}
134234
134343
  exports2.DocReAuthCallbacks = DocReAuthCallbacks;
134235
134344
  exports2.DragDrop = DragDrop;
134236
134345
  exports2.DrawioEmbed = DrawioEmbed;
134346
+ exports2.DrawioPasteHandler = DrawioPasteHandler;
134237
134347
  exports2.EditorBlocks = EditorBlocks;
134238
134348
  exports2.EditorBoxes = EditorBoxes;
134239
134349
  exports2.EditorCommandProviders = EditorCommandProviders;