@ones-editor/editor 2.2.16-beta.1 → 2.2.16-beta.10

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