@ones-editor/editor 2.8.35 → 2.9.1-beta.3

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.
Files changed (44) hide show
  1. package/@ones-editor/comments/src/comments/comments.d.ts +5 -1
  2. package/@ones-editor/comments/src/comments-helper/active-comment.d.ts +3 -1
  3. package/@ones-editor/comments/src/comments-helper/get-comment-from-selection.d.ts +3 -0
  4. package/@ones-editor/comments/src/comments-helper/get-comments-from-doc.d.ts +5 -1
  5. package/@ones-editor/comments/src/comments-helper/old-version-comment.d.ts +2 -1
  6. package/@ones-editor/comments/src/comments-list/comments-list.d.ts +14 -2
  7. package/@ones-editor/comments/src/comments-list/group-item.d.ts +2 -0
  8. package/@ones-editor/comments/src/comments-list/group-list.d.ts +8 -2
  9. package/@ones-editor/comments/src/comments-list/handler.d.ts +2 -1
  10. package/@ones-editor/comments/src/comments-list/mini-comment/group-list.d.ts +1 -1
  11. package/@ones-editor/comments/src/comments-list/mini-comment/mini-comments-list.d.ts +1 -0
  12. package/@ones-editor/comments/src/comments-list/mobile-comments-list/mobile-comments-list.d.ts +1 -0
  13. package/@ones-editor/comments/src/comments-render/get-block-comments.d.ts +5 -0
  14. package/@ones-editor/comments/src/comments-render/index.d.ts +10 -1
  15. package/@ones-editor/comments/src/constant/index.d.ts +2 -1
  16. package/@ones-editor/comments/src/index.d.ts +1 -0
  17. package/@ones-editor/comments/src/locale/en-us.d.ts +9 -0
  18. package/@ones-editor/comments/src/locale/ja-jp.d.ts +9 -0
  19. package/@ones-editor/comments/src/locale/zh-cn.d.ts +9 -0
  20. package/@ones-editor/comments/src/resolved-comments/index.d.ts +4 -0
  21. package/@ones-editor/comments/src/resolved-comments/resolved-comment-editor.d.ts +14 -0
  22. package/@ones-editor/comments/src/resolved-comments/resolved-comment-list.d.ts +4 -0
  23. package/@ones-editor/comments/src/types.d.ts +7 -1
  24. package/@ones-editor/core/src/core/block-renderers/block-renderers.d.ts +1 -0
  25. package/@ones-editor/core/src/core/composition/editor-input.d.ts +2 -0
  26. package/@ones-editor/core/src/core/doc/doc.d.ts +9 -0
  27. package/@ones-editor/core/src/core/types.d.ts +3 -0
  28. package/@ones-editor/core/src/local-doc/index.d.ts +1 -0
  29. package/@ones-editor/core/src/utils/dom.d.ts +1 -0
  30. package/@ones-editor/graph-embed/package.json +0 -1
  31. package/@ones-editor/sharedb-doc/src/doc/comments.d.ts +2 -1
  32. package/@ones-editor/sharedb-doc/src/doc/op-parser/parse-handler.d.ts +2 -1
  33. package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +3 -1
  34. package/@ones-editor/sharedb-doc/src/types.d.ts +1 -0
  35. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  36. package/@ones-editor/ui/src/readonly-toolbar/add-comment-to-old-doc.d.ts +1 -0
  37. package/@ones-editor/ui-base/src/icons/index.d.ts +2 -1
  38. package/@ones-editor/versions/src/version-dialog/history-handler.d.ts +1 -0
  39. package/dist/comments/local-doc-comments-provider.d.ts +2 -1
  40. package/dist/comments/sharedb-doc-comments-provider.d.ts +3 -1
  41. package/dist/index.d.ts +2 -0
  42. package/dist/index.js +1063 -171
  43. package/dist/types.d.ts +2 -0
  44. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -4116,6 +4116,7 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4116
4116
  .comment-item-root .item-head-tools {
4117
4117
  display: flex;
4118
4118
  align-items: center;
4119
+ justify-content: center;
4119
4120
  visibility: hidden;
4120
4121
  }
4121
4122
  .comment-item-root .item-head-tools .editor-text-button {
@@ -4125,8 +4126,8 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4125
4126
  color: #0064ff;
4126
4127
  }
4127
4128
  .comment-item-root .item-head-tools .editor-text-button svg {
4128
- width: 20px;
4129
- height: 20px;
4129
+ width: 16px;
4130
+ height: 16px;
4130
4131
  }
4131
4132
  .comment-item-root .item-head-tools.active {
4132
4133
  visibility: visible;
@@ -4319,6 +4320,36 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4319
4320
  will-change: width;
4320
4321
  font-family: var(--editor-font-family);
4321
4322
  }
4323
+ .editor-web-comment-root.disable-resolve .comment-groups-container .item-head-switch .editor-text-button[data-button-id=resolve] {
4324
+ display: none;
4325
+ }
4326
+ .editor-web-comment-root.disable-resolve .comment-groups-container .comment-actions button.comment-reopen {
4327
+ display: none;
4328
+ }
4329
+ .editor-web-comment-root .comment-groups-container .no-comment-tip {
4330
+ font-size: 12px;
4331
+ width: 100%;
4332
+ color: #BEBFC2;
4333
+ display: flex;
4334
+ justify-content: center;
4335
+ align-items: center;
4336
+ margin-top: 100px;
4337
+ }
4338
+ .editor-web-comment-root[list-type=resolved] .comment-groups-container {
4339
+ display: flex;
4340
+ flex-direction: column;
4341
+ padding-left: 8px;
4342
+ padding-top: 60px;
4343
+ }
4344
+ .editor-web-comment-root[list-type=resolved] .comment-groups-container .comment-group-item-root {
4345
+ margin-bottom: 20px;
4346
+ position: inherit;
4347
+ transform: none;
4348
+ }
4349
+ .editor-web-comment-root[list-type=resolved] .comment-groups-container .comment-group-item-root::before {
4350
+ left: 8px;
4351
+ right: 8px;
4352
+ }
4322
4353
  .editor-web-comment-root .comment-groups-container .comment-group-item-root {
4323
4354
  position: absolute;
4324
4355
  left: 50%;
@@ -4332,8 +4363,17 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4332
4363
  box-shadow: var(--editor-box-shadow);
4333
4364
  padding-bottom: 10px;
4334
4365
  }
4366
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root.resolved .comment-item-head .item-head-switch {
4367
+ display: none;
4368
+ }
4369
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root.resolved .item-head-tools {
4370
+ display: none;
4371
+ }
4372
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root.resolved .comment-quick-reply {
4373
+ display: none;
4374
+ }
4335
4375
  .editor-web-comment-root .comment-groups-container .comment-group-item-root:not(.no-animation) {
4336
- transition: top 0.2s ease-in, opacity 0.35s ease-in;
4376
+ transition: top 0.2s ease-in, opacity 0.2s ease-in;
4337
4377
  }
4338
4378
  .editor-web-comment-root .comment-groups-container .comment-group-item-root::before {
4339
4379
  content: "";
@@ -4380,16 +4420,23 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4380
4420
  display: flex;
4381
4421
  align-items: center;
4382
4422
  height: 22px;
4383
- visibility: hidden;
4384
4423
  }
4385
4424
  .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button {
4386
4425
  padding: 0;
4387
4426
  width: var(--editor-comment-switch-button-width);
4388
- margin: 3px 0;
4427
+ margin-right: 5px;
4389
4428
  color: #606060;
4429
+ width: 16px;
4430
+ height: 16px;
4390
4431
  }
4391
4432
  .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button[data-button-id=switch-up] {
4392
- margin-right: 16px;
4433
+ visibility: hidden;
4434
+ }
4435
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button[data-button-id=switch-down] {
4436
+ visibility: hidden;
4437
+ }
4438
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button[data-button-id=resolve] {
4439
+ margin-right: 0;
4393
4440
  }
4394
4441
  .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button:not(.disabled):hover {
4395
4442
  color: var(--text-button-color-hover);
@@ -4398,15 +4445,70 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4398
4445
  color: rgba(96, 96, 96, 0.5019607843);
4399
4446
  cursor: not-allowed;
4400
4447
  }
4448
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer {
4449
+ font-size: 12px;
4450
+ line-height: 20px;
4451
+ color: #87888A;
4452
+ margin-top: 10px;
4453
+ }
4454
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-resolved {
4455
+ font-size: 12px;
4456
+ color: #87888a;
4457
+ flex-grow: 1;
4458
+ display: flex;
4459
+ white-space: nowrap;
4460
+ }
4461
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-resolved .resolver-name {
4462
+ flex-shrink: 1;
4463
+ white-space: nowrap;
4464
+ overflow: hidden;
4465
+ text-overflow: ellipsis;
4466
+ }
4467
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions {
4468
+ display: flex;
4469
+ align-items: center;
4470
+ }
4471
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions .comment-date {
4472
+ flex: 1;
4473
+ white-space: nowrap;
4474
+ }
4475
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions .removed-tips {
4476
+ color: #87888A;
4477
+ white-space: nowrap;
4478
+ text-overflow: ellipsis;
4479
+ overflow: hidden;
4480
+ margin-left: 10px;
4481
+ }
4482
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions .comment-reopen {
4483
+ background: none;
4484
+ border: none;
4485
+ cursor: pointer;
4486
+ color: #575859;
4487
+ font-size: 12px;
4488
+ }
4489
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions .comment-reopen:hover {
4490
+ color: #0064FF;
4491
+ }
4401
4492
  .editor-web-comment-root .comment-groups-container .comment-group-item-root.active::before {
4402
4493
  background-color: #f59300;
4403
4494
  }
4404
- .editor-web-comment-root .comment-groups-container .comment-group-item-root.active .item-head-switch {
4495
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root.active .item-head-switch .editor-text-button[data-button-id=switch-up] {
4496
+ visibility: visible;
4497
+ }
4498
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root.active .item-head-switch .editor-text-button[data-button-id=switch-down] {
4405
4499
  visibility: visible;
4406
4500
  }
4407
4501
  .editor-web-comment-root .comment-groups-container .comment-group-item-root.readonly .comment-quick-reply .quick-reply-button.invisible {
4408
4502
  display: none;
4409
4503
  }
4504
+ .editor-web-comment-root .comment-switcher-container {
4505
+ position: absolute;
4506
+ z-index: 1;
4507
+ top: 0;
4508
+ left: 0;
4509
+ right: 0;
4510
+ font-size: 14px;
4511
+ }
4410
4512
  .editor-mobile-comments-root {
4411
4513
  position: fixed;
4412
4514
  left: 0;
@@ -4508,6 +4610,108 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4508
4610
  }
4509
4611
  :is(.editor-web-comment-root, .editor-mobile-comments-root, .editor-mini-comment-root).hidden {
4510
4612
  display: none;
4613
+ }
4614
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block].text-block.comment > div[data-type=block-content] > span {
4615
+ border-bottom-color: transparent;
4616
+ }
4617
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block] span.text.comment,
4618
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block] span[data-type=editor-box].comment {
4619
+ border-bottom-color: transparent;
4620
+ }
4621
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block] span.text.comment.active,
4622
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block] span[data-type=editor-box].comment.active {
4623
+ background-color: transparent;
4624
+ }
4625
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block].comment::after {
4626
+ background-color: transparent;
4627
+ }
4628
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block].comment.active {
4629
+ outline: none;
4630
+ }.resolved-comment-list .resolved-comment-group-item-root {
4631
+ padding: 10px 20px;
4632
+ border-bottom: 1px solid #f0f0f0;
4633
+ margin-right: 10px;
4634
+ }
4635
+ .resolved-comment-list .resolved-comment-group-item-root .comment-group-head {
4636
+ margin-bottom: 5px;
4637
+ }
4638
+ .resolved-comment-list .resolved-comment-group-item-root .comment-group-head span {
4639
+ padding: 0 5px;
4640
+ display: inline-block;
4641
+ line-height: 2;
4642
+ background-color: #FFF0D9;
4643
+ }
4644
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container,
4645
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container {
4646
+ padding-left: 10px;
4647
+ }
4648
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root,
4649
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root {
4650
+ position: relative;
4651
+ }
4652
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root:not(.no-children)::before,
4653
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root:not(.no-children)::before {
4654
+ content: " ";
4655
+ display: block;
4656
+ position: absolute;
4657
+ left: 10px;
4658
+ width: 1px;
4659
+ background-color: #DFE1E5;
4660
+ overflow: hidden;
4661
+ opacity: 0.8;
4662
+ top: 21px;
4663
+ bottom: -12px;
4664
+ transform: scaleX(0.5);
4665
+ }
4666
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root .comment-head,
4667
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root .comment-head {
4668
+ padding: 0;
4669
+ position: relative;
4670
+ display: flex;
4671
+ align-items: center;
4672
+ }
4673
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root .comment-head .comment-avatar,
4674
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root .comment-head .comment-avatar {
4675
+ margin-right: 5px;
4676
+ width: var(--editor-comment-avatar-width, 22px);
4677
+ height: var(--editor-comment-avatar-width, 22px);
4678
+ border-radius: 100%;
4679
+ }
4680
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root .comment-head .comment-username,
4681
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root .comment-head .comment-username {
4682
+ font-size: var(--editor-comment-username-font-size, 12px);
4683
+ color: #2d2d2e;
4684
+ overflow: hidden;
4685
+ text-overflow: ellipsis;
4686
+ white-space: nowrap;
4687
+ }
4688
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root .comment-head .comment-modified,
4689
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root .comment-head .comment-modified {
4690
+ margin-left: 10px;
4691
+ font-size: 12px;
4692
+ color: #87888a;
4693
+ flex-grow: 1;
4694
+ white-space: nowrap;
4695
+ }
4696
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root .comment-editor,
4697
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root .comment-editor {
4698
+ border: none;
4699
+ padding-top: 0;
4700
+ margin-top: 0;
4701
+ padding-left: 10px;
4702
+ margin-left: 0;
4703
+ }
4704
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root:last-child::before {
4705
+ display: none;
4706
+ }
4707
+ .resolved-comment-list .resolved-comment-group-item-root .comment-item-footer .comment-resolved {
4708
+ margin-left: 10px;
4709
+ font-size: 12px;
4710
+ color: #87888a;
4711
+ flex-grow: 1;
4712
+ white-space: nowrap;
4713
+ overflow: hidden;
4714
+ text-overflow: ellipsis;
4511
4715
  }div[data-type=editor-block].table-block {
4512
4716
  --table-bar-width: 6px;
4513
4717
  --table-bar-left: -6px;
@@ -9228,22 +9432,22 @@ var __publicField = (obj, key, value) => {
9228
9432
  function toFloat(value) {
9229
9433
  return parseFloat(value) || 0;
9230
9434
  }
9231
- function getBordersSize(styles) {
9435
+ function getBordersSize(styles2) {
9232
9436
  var positions = [];
9233
9437
  for (var _i = 1; _i < arguments.length; _i++) {
9234
9438
  positions[_i - 1] = arguments[_i];
9235
9439
  }
9236
9440
  return positions.reduce(function(size, position) {
9237
- var value = styles["border-" + position + "-width"];
9441
+ var value = styles2["border-" + position + "-width"];
9238
9442
  return size + toFloat(value);
9239
9443
  }, 0);
9240
9444
  }
9241
- function getPaddings(styles) {
9445
+ function getPaddings(styles2) {
9242
9446
  var positions = ["top", "right", "bottom", "left"];
9243
9447
  var paddings = {};
9244
9448
  for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
9245
9449
  var position = positions_1[_i];
9246
- var value = styles["padding-" + position];
9450
+ var value = styles2["padding-" + position];
9247
9451
  paddings[position] = toFloat(value);
9248
9452
  }
9249
9453
  return paddings;
@@ -9257,17 +9461,17 @@ var __publicField = (obj, key, value) => {
9257
9461
  if (!clientWidth && !clientHeight) {
9258
9462
  return emptyRect;
9259
9463
  }
9260
- var styles = getWindowOf(target).getComputedStyle(target);
9261
- var paddings = getPaddings(styles);
9464
+ var styles2 = getWindowOf(target).getComputedStyle(target);
9465
+ var paddings = getPaddings(styles2);
9262
9466
  var horizPad = paddings.left + paddings.right;
9263
9467
  var vertPad = paddings.top + paddings.bottom;
9264
- var width = toFloat(styles.width), height = toFloat(styles.height);
9265
- if (styles.boxSizing === "border-box") {
9468
+ var width = toFloat(styles2.width), height = toFloat(styles2.height);
9469
+ if (styles2.boxSizing === "border-box") {
9266
9470
  if (Math.round(width + horizPad) !== clientWidth) {
9267
- width -= getBordersSize(styles, "left", "right") + horizPad;
9471
+ width -= getBordersSize(styles2, "left", "right") + horizPad;
9268
9472
  }
9269
9473
  if (Math.round(height + vertPad) !== clientHeight) {
9270
- height -= getBordersSize(styles, "top", "bottom") + vertPad;
9474
+ height -= getBordersSize(styles2, "top", "bottom") + vertPad;
9271
9475
  }
9272
9476
  }
9273
9477
  if (!isDocumentElement(target)) {
@@ -9895,6 +10099,54 @@ var __publicField = (obj, key, value) => {
9895
10099
  }
9896
10100
  };
9897
10101
  }
10102
+ async function loadEmsJs(id, mjsUrl, mjsName, jsCode) {
10103
+ const promise = new Promise((resolve, reject) => {
10104
+ const script = document.getElementById(id);
10105
+ if (script) {
10106
+ setTimeout(() => {
10107
+ resolve();
10108
+ });
10109
+ return;
10110
+ }
10111
+ const funName = `emsjs_${genId()}`;
10112
+ window[funName] = (err) => {
10113
+ if (err) {
10114
+ console.error("loadEmsJs error:", mjsUrl, err);
10115
+ const script2 = document.getElementById(id);
10116
+ if (script2) {
10117
+ script2.remove();
10118
+ }
10119
+ reject(err);
10120
+ } else {
10121
+ resolve();
10122
+ }
10123
+ };
10124
+ const code = `
10125
+ try {
10126
+ const ${mjsName} = await import('${mjsUrl}');
10127
+ window.${mjsName} = ${mjsName}.default;
10128
+ ${jsCode}
10129
+ window.${funName}();
10130
+ } catch (err) {
10131
+ window.${funName}(err);
10132
+ }
10133
+ window.${funName} = undefined;
10134
+ delete window.${funName};
10135
+ `;
10136
+ const elem2 = document.createElement("script");
10137
+ elem2.type = "module";
10138
+ elem2.async = true;
10139
+ elem2.id = id;
10140
+ elem2.innerHTML = code;
10141
+ document.head.appendChild(elem2);
10142
+ });
10143
+ try {
10144
+ await lockers.lock(id);
10145
+ await promise;
10146
+ } finally {
10147
+ lockers.release(id);
10148
+ }
10149
+ }
9898
10150
  async function loadJsPromise(url, id) {
9899
10151
  const promise = new Promise((resolve, reject) => {
9900
10152
  loadJs(url, id, (err) => {
@@ -9922,8 +10174,8 @@ var __publicField = (obj, key, value) => {
9922
10174
  el.setAttribute(key, value);
9923
10175
  });
9924
10176
  }
9925
- function setStyles(el, styles) {
9926
- Object.entries(styles).forEach(([key, value]) => {
10177
+ function setStyles(el, styles2) {
10178
+ Object.entries(styles2).forEach(([key, value]) => {
9927
10179
  el.style.setProperty(key, value);
9928
10180
  });
9929
10181
  }
@@ -12343,12 +12595,12 @@ var __publicField = (obj, key, value) => {
12343
12595
  return blockClass.getBlockStyles(editor, block);
12344
12596
  }
12345
12597
  const data2 = editor.getBlockData(block);
12346
- const styles = Object.fromEntries(Object.entries(data2).filter(([key]) => key.startsWith("style-")));
12347
- Object.entries(styles).forEach(([, value]) => {
12598
+ const styles2 = Object.fromEntries(Object.entries(data2).filter(([key]) => key.startsWith("style-")));
12599
+ Object.entries(styles2).forEach(([, value]) => {
12348
12600
  const type = typeof value;
12349
12601
  assert(logger$4C, type === "string" || type === "number" || type === "boolean", "invalid style value");
12350
12602
  });
12351
- return styles;
12603
+ return styles2;
12352
12604
  }
12353
12605
  function getContainerWidth(container, options) {
12354
12606
  const ret = container.getBoundingClientRect().width;
@@ -24937,7 +25189,7 @@ var __publicField = (obj, key, value) => {
24937
25189
  if (attributes) {
24938
25190
  let string = op.insert;
24939
25191
  const tags = [];
24940
- let styles = "";
25192
+ let styles2 = "";
24941
25193
  if (attributes["style-bold"]) {
24942
25194
  tags.push("strong");
24943
25195
  }
@@ -24955,25 +25207,25 @@ var __publicField = (obj, key, value) => {
24955
25207
  }
24956
25208
  const fontBgColor = Object.keys(attributes).find((k) => k.startsWith("style-bg-color-"));
24957
25209
  if (fontBgColor) {
24958
- styles += `background-color: ${styleBackgroundColorToHighlight$1(fontBgColor)};`;
25210
+ styles2 += `background-color: ${styleBackgroundColorToHighlight$1(fontBgColor)};`;
24959
25211
  }
24960
25212
  const fontColor = Object.keys(attributes).find((k) => k.startsWith("style-color-"));
24961
25213
  if (fontColor) {
24962
- styles += `color: ${styleColorToColor$1(fontColor)};`;
25214
+ styles2 += `color: ${styleColorToColor$1(fontColor)};`;
24963
25215
  }
24964
25216
  if (attributes.link) {
24965
25217
  string = `<a href="${attributes.link}">${string}</a>`;
24966
25218
  }
24967
25219
  let prefix = tags.map((s) => `<${s}>`).join("");
24968
25220
  let suffix = tags.reverse().map((s) => `</${s}>`).join("");
24969
- if (styles) {
25221
+ if (styles2) {
24970
25222
  if (attributes.link) {
24971
- string = `<a href="${attributes.link}" style="${styles}">${op.insert}</a>`;
25223
+ string = `<a href="${attributes.link}" style="${styles2}">${op.insert}</a>`;
24972
25224
  } else {
24973
25225
  if (prefix) {
24974
- prefix = prefix.replace(">", ` style="${styles}">`);
25226
+ prefix = prefix.replace(">", ` style="${styles2}">`);
24975
25227
  } else {
24976
- prefix = `<span style="${styles}">`;
25228
+ prefix = `<span style="${styles2}">`;
24977
25229
  suffix = "</span>";
24978
25230
  }
24979
25231
  }
@@ -25416,6 +25668,9 @@ var __publicField = (obj, key, value) => {
25416
25668
  __publicField(this, "renders", []);
25417
25669
  this.editor = editor;
25418
25670
  }
25671
+ getRenderers() {
25672
+ return this.renders;
25673
+ }
25419
25674
  registerRender(render) {
25420
25675
  this.renders.push(render);
25421
25676
  }
@@ -25653,8 +25908,8 @@ var __publicField = (obj, key, value) => {
25653
25908
  renderBlock(editor, path, blockData) {
25654
25909
  var _a, _b;
25655
25910
  const attributes = {};
25656
- const styles = Object.entries(blockData).filter((k) => k[0].startsWith("style-"));
25657
- styles.forEach(([key, value]) => {
25911
+ const styles2 = Object.entries(blockData).filter((k) => k[0].startsWith("style-"));
25912
+ styles2.forEach(([key, value]) => {
25658
25913
  attributes[`data-${key}`] = `${value}`;
25659
25914
  });
25660
25915
  const classes = [];
@@ -25861,6 +26116,7 @@ var __publicField = (obj, key, value) => {
25861
26116
  constructor(editor, callbacks) {
25862
26117
  __publicField(this, "editor");
25863
26118
  __publicField(this, "composing", false);
26119
+ __publicField(this, "composingTimer");
25864
26120
  __publicField(this, "callbacks");
25865
26121
  __publicField(this, "inputElement");
25866
26122
  __publicField(this, "handleBlur", () => {
@@ -25920,12 +26176,13 @@ var __publicField = (obj, key, value) => {
25920
26176
  if (!this.editor.isWritable()) {
25921
26177
  return;
25922
26178
  }
26179
+ clearTimeout(this.composingTimer);
25923
26180
  this.composing = true;
25924
26181
  this.callbacks.onCompositionStart(event);
25925
26182
  });
25926
26183
  __publicField(this, "handleCompositionend", (event) => {
25927
26184
  if (isSafari()) {
25928
- setTimeout(() => {
26185
+ this.composingTimer = setTimeout(() => {
25929
26186
  this.composing = false;
25930
26187
  }, 100);
25931
26188
  } else {
@@ -31625,7 +31882,7 @@ ${codeText}
31625
31882
  const logger$38 = getLogger("editor");
31626
31883
  class Editor extends tinyTypedEmitter.TypedEmitter {
31627
31884
  constructor(parent, doc2, optionalOptions) {
31628
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
31885
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
31629
31886
  super();
31630
31887
  __publicField(this, "parent");
31631
31888
  __publicField(this, "rootElement");
@@ -31671,12 +31928,13 @@ ${codeText}
31671
31928
  componentsOptions: (_c = (_b = optionalOptions == null ? void 0 : optionalOptions.components) == null ? void 0 : _b.options) != null ? _c : {},
31672
31929
  scrollContainer: optionalOptions == null ? void 0 : optionalOptions.scrollContainer,
31673
31930
  enableComments: (_d = optionalOptions == null ? void 0 : optionalOptions.enableComments) != null ? _d : true,
31674
- enableContextMenu: (_e = optionalOptions == null ? void 0 : optionalOptions.enableContextMenu) != null ? _e : true
31931
+ enableResolveComments: (_e = optionalOptions == null ? void 0 : optionalOptions.enableResolveComments) != null ? _e : true,
31932
+ enableContextMenu: (_f = optionalOptions == null ? void 0 : optionalOptions.enableContextMenu) != null ? _f : true
31675
31933
  };
31676
- this.settingsProvider = (_f = optionalOptions == null ? void 0 : optionalOptions.settingsProvider) != null ? _f : new DefaultSettingsProvider(this);
31934
+ this.settingsProvider = (_g = optionalOptions == null ? void 0 : optionalOptions.settingsProvider) != null ? _g : new DefaultSettingsProvider(this);
31677
31935
  registerComponents(this, optionalOptions == null ? void 0 : optionalOptions.components);
31678
- this.blockHooks.push(...(_h = (_g = optionalOptions == null ? void 0 : optionalOptions.components) == null ? void 0 : _g.blockHooks) != null ? _h : []);
31679
- this.id = (_i = optionalOptions == null ? void 0 : optionalOptions.id) != null ? _i : genId();
31936
+ this.blockHooks.push(...(_i = (_h = optionalOptions == null ? void 0 : optionalOptions.components) == null ? void 0 : _h.blockHooks) != null ? _i : []);
31937
+ this.id = (_j = optionalOptions == null ? void 0 : optionalOptions.id) != null ? _j : genId();
31680
31938
  this.clientId = genId();
31681
31939
  this.undoManager = new UndoManager(this);
31682
31940
  this.doc = new EditorDoc(this, doc2, this.undoManager);
@@ -32162,6 +32420,9 @@ ${codeText}
32162
32420
  toJSON() {
32163
32421
  return cloneDeep__default.default(this.doc);
32164
32422
  }
32423
+ rawData() {
32424
+ return this.doc;
32425
+ }
32165
32426
  getContainerBlocks(containerId) {
32166
32427
  const blocks = this.doc.blocks[containerId];
32167
32428
  return blocks;
@@ -38682,6 +38943,12 @@ ${codeText}
38682
38943
  commentId
38683
38944
  });
38684
38945
  }
38946
+ onUpdateCommentResolver(commentId) {
38947
+ this.pushActions({
38948
+ type: "updateCommentResolved",
38949
+ commentId
38950
+ });
38951
+ }
38685
38952
  end() {
38686
38953
  const actions2 = this.actions;
38687
38954
  const deletedBlocks = /* @__PURE__ */ new Set();
@@ -38756,6 +39023,9 @@ ${codeText}
38756
39023
  } else if (action.type === "updateComment") {
38757
39024
  const a = action;
38758
39025
  this.outerHandler.onUpdateComment(a.commentId, this.local);
39026
+ } else if (action.type === "updateCommentResolved") {
39027
+ const a = action;
39028
+ this.outerHandler.onUpdateCommentResolver(a.commentId, this.local);
38759
39029
  }
38760
39030
  });
38761
39031
  Array.from(updatingBlockDataDeltaMap.entries()).forEach(([blockId, objectData]) => {
@@ -38933,7 +39203,14 @@ ${codeText}
38933
39203
  assert(logger$2W, commentId, `invalid comment op, no commentId: ${JSON.stringify(ops)}`);
38934
39204
  assert(logger$2W, actions2, `invalid comment op, no actions: ${JSON.stringify(ops)}`);
38935
39205
  if (typeof actions2 === "string") {
38936
- logger$2W.error(`unknown comment op, ${JSON.stringify(ops)}`);
39206
+ const data2 = ops[3];
39207
+ if (actions2 === "resolver" && typeof data2 === "object") {
39208
+ if (parseType === "upsert") {
39209
+ handler.onUpdateCommentResolver(commentId);
39210
+ }
39211
+ } else {
39212
+ logger$2W.error(`unknown comment op, ${JSON.stringify(ops)}`);
39213
+ }
38937
39214
  } else {
38938
39215
  if (actions2.i && actions2.r) {
38939
39216
  if (parseType === "upsert") {
@@ -39043,7 +39320,8 @@ ${codeText}
39043
39320
  avatarUrl,
39044
39321
  abstract,
39045
39322
  created,
39046
- modified
39323
+ modified,
39324
+ resolver: resolved
39047
39325
  } = shareDBComment;
39048
39326
  return {
39049
39327
  id,
@@ -39053,7 +39331,8 @@ ${codeText}
39053
39331
  avatarUrl,
39054
39332
  abstract,
39055
39333
  created,
39056
- modified
39334
+ modified,
39335
+ resolver: resolved
39057
39336
  };
39058
39337
  }
39059
39338
  function commentToShareDbComment(comment, doc2) {
@@ -39525,6 +39804,21 @@ ${codeText}
39525
39804
  const op = ["comments", comment.id, { r: true, i: shareDBComment }];
39526
39805
  return this.submitOp(op);
39527
39806
  }
39807
+ localUpdateCommentResolver(commentId, resolver) {
39808
+ const oldComment = this.getComment(commentId);
39809
+ const oldResolved = oldComment.resolver;
39810
+ const op = ["comments", commentId, "resolver", {}];
39811
+ if (!oldResolved && !resolver) {
39812
+ return Promise.resolve(true);
39813
+ }
39814
+ if (oldResolved !== void 0) {
39815
+ op[3] = { r: true };
39816
+ }
39817
+ if (resolver) {
39818
+ op[3].i = resolver;
39819
+ }
39820
+ return this.submitOp(op);
39821
+ }
39528
39822
  destroy() {
39529
39823
  var _a;
39530
39824
  this.destroyed = true;
@@ -39601,6 +39895,13 @@ ${codeText}
39601
39895
  return (_a = cb.onUpdateComment) == null ? void 0 : _a.call(cb, commentId, local);
39602
39896
  });
39603
39897
  }
39898
+ onUpdateCommentResolver(commentId, local) {
39899
+ assert(logger$2T, this.callbacks.length > 0, "no callbacks");
39900
+ this.callbacks.forEach((cb) => {
39901
+ var _a;
39902
+ return (_a = cb.onUpdateCommentResolver) == null ? void 0 : _a.call(cb, commentId, local);
39903
+ });
39904
+ }
39604
39905
  onCustomMessage(msg) {
39605
39906
  const message = msg;
39606
39907
  if ((message == null ? void 0 : message.type) === "custom" && (message == null ? void 0 : message.clientId) !== this.client.clientId) {
@@ -40669,6 +40970,7 @@ ${codeText}
40669
40970
  const RefreshIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M15.3498 7.51663L12.9692 9.49971L10.5902 7.51663" stroke="currentColor"/>\n<path d="M12.811 9.5C12.9344 9.02057 13 8.51795 13 8C13 4.68629 10.3137 2 7 2C3.68629 2 1 4.68629 1 8C1 11.3137 3.68629 14 7 14C8.39546 14 9.67966 13.5236 10.6988 12.7246" stroke="currentColor"/>\n</svg>';
40670
40971
  const HelpIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M15 8C15 11.8659 11.8659 15 8 15C4.13408 15 1 11.8659 1 8C1 4.13408 4.13408 1 8 1C11.8659 1 15 4.13408 15 8Z" stroke="currentColor"/>\n<path d="M6 6.41815C6 5.81984 6.55057 4.52136 7.98652 4.52136C9.24198 4.52136 10 5.42027 10 6.41815C10 7.24315 9.34611 7.76435 8.89738 8.21308C7.99992 9.11055 7.99992 10.0001 7.99992 10.0001" stroke="currentColor"/>\n<path d="M8 11V13" stroke="currentColor"/>\n</svg>\n';
40671
40972
  const CheckMarkIcon = '<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" stroke-width="2">\n <path d="m1 7.4 1.497-1.498 3.861 3.86L12.85 2.45l1.498 1.497-6.491 7.312.005.007-.096.095-1.318 1.486L1 7.399Z" fill="currentColor" fill-rule="nonzero"></path>\n</svg>';
40973
+ const CircleCheckMarkIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M10.9825 5.99158L7.19788 10.0128L5.30554 8.12045" stroke="currentColor" stroke-linejoin="round"/>\n<circle cx="8.03119" cy="7.99481" r="4.98883" stroke="currentColor"/>\n</svg>\n';
40672
40974
  const TextIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M2.5 4L2.5 1.5L13.5 1.5V4" stroke="currentColor" stroke-linejoin="round"/>\n<path d="M8 14.5V2" stroke="currentColor"/>\n<path d="M5 14.5H11" stroke="currentColor" stroke-linejoin="round"/>\n</svg>\n';
40673
40975
  const rightArrow = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.76573 4.17763L9.58809 7.99999L5.76573 11.8209" stroke="currentColor" stroke-width="2"/>\n</svg>\n';
40674
40976
  const BilibiliIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M11.3909 3.71427H11.8891C12.7699 3.74577 13.5043 4.05144 14.09 4.63244C14.6757 5.21285 14.979 5.94435 15 6.82577V11.1191C14.979 11.9999 14.6757 12.7344 14.09 13.32C13.5043 13.9057 12.7705 14.209 11.8891 14.23H4.11092C3.23008 14.209 2.49567 13.9057 1.91 13.32C1.32433 12.7344 1.021 12.0005 1 11.1191V6.82577C1.021 5.94435 1.32433 5.21285 1.91 4.63244C2.49567 4.05144 3.2295 3.74577 4.11092 3.71427H4.56242L3.87758 3.06094C3.80715 2.99237 3.75151 2.9101 3.71409 2.81921C3.67667 2.72831 3.65826 2.63072 3.66 2.53244C3.66 2.32477 3.73233 2.1486 3.87758 2.00335L3.89333 1.9876C4.04908 1.84235 4.22758 1.77002 4.43 1.77002C4.63242 1.77002 4.81092 1.84235 4.96667 1.9876L6.63092 3.59002C6.67233 3.63144 6.70908 3.67285 6.74 3.71427H9.22908C9.25335 3.66813 9.28486 3.62618 9.32242 3.59002L10.9867 1.9876C11.1424 1.84235 11.3209 1.77002 11.5233 1.77002C11.7258 1.77002 11.9095 1.8581 12.0652 2.00335C12.221 2.1486 12.2933 2.32477 12.2933 2.53244C12.2933 2.73952 12.221 2.91569 12.0757 3.06094L11.3909 3.71427ZM4.11092 5.22335C3.67575 5.23385 3.31 5.38435 3.01425 5.67427C2.71908 5.96477 2.56567 6.33344 2.55575 6.7791V11.1658C2.56567 11.6114 2.71908 11.9795 3.01425 12.27C3.31 12.5605 3.67575 12.711 4.11092 12.7209H11.8891C12.3242 12.711 12.69 12.5605 12.9858 12.27C13.2809 11.9795 13.4343 11.6114 13.4442 11.1658V6.7791C13.4343 6.33285 13.2809 5.96477 12.9858 5.67427C12.69 5.38435 12.3242 5.23385 11.8891 5.22335H4.11092ZM5.66667 7.4791C5.88425 7.4791 6.06567 7.55144 6.21092 7.69669C6.35675 7.84194 6.43433 8.0286 6.44425 8.25669V8.94094C6.43433 9.16902 6.35675 9.35569 6.21092 9.50094C6.06567 9.64677 5.88425 9.7191 5.66667 9.7191C5.44908 9.7191 5.26767 9.64619 5.12242 9.50094C4.97658 9.35569 4.899 9.16902 4.88908 8.94094V8.25669C4.88908 8.0391 4.96433 7.85477 5.11425 7.70427C5.26475 7.55435 5.44908 7.4791 5.66667 7.4791ZM10.3333 7.4791C10.5509 7.4791 10.7323 7.55144 10.8776 7.69669C11.0234 7.84194 11.101 8.0286 11.1109 8.25669V8.94094C11.101 9.16902 11.0234 9.35569 10.8776 9.50094C10.7323 9.64677 10.5509 9.7191 10.3333 9.7191C10.1157 9.7191 9.93433 9.64619 9.78908 9.50094C9.64325 9.35569 9.56567 9.16902 9.55575 8.94094V8.25669C9.56567 8.0286 9.64325 7.84194 9.78908 7.69669C9.93433 7.55144 10.1157 7.4791 10.3333 7.4791Z" fill="#07A3D7"/>\n</svg>\n';
@@ -40824,6 +41126,7 @@ ${codeText}
40824
41126
  RefreshIcon,
40825
41127
  HelpIcon,
40826
41128
  CheckMarkIcon,
41129
+ CircleCheckMarkIcon,
40827
41130
  TextIcon,
40828
41131
  RightArrowIcon: rightArrow,
40829
41132
  TencentVideoIcon,
@@ -50633,7 +50936,7 @@ ${codeText}
50633
50936
  });
50634
50937
  return !!ret;
50635
50938
  }
50636
- function addBlockClasses(from, to, styles) {
50939
+ function addBlockClasses(from, to, styles2) {
50637
50940
  const container = getParentContainer(from);
50638
50941
  if (to) {
50639
50942
  const container2 = getParentContainer(to);
@@ -50644,18 +50947,18 @@ ${codeText}
50644
50947
  const toIndex = getBlockIndex(to);
50645
50948
  assert(logger$24, fromIndex <= toIndex, "invalid block index");
50646
50949
  }
50647
- addClass(from, ...styles);
50950
+ addClass(from, ...styles2);
50648
50951
  if (!to || to === from) {
50649
50952
  return;
50650
50953
  }
50651
50954
  let next2 = getNextBlock(from);
50652
50955
  while (next2 !== to) {
50653
50956
  assert(logger$24, next2, "no next button");
50654
- addClass(next2, ...styles);
50957
+ addClass(next2, ...styles2);
50655
50958
  next2 = getNextBlock(next2);
50656
50959
  }
50657
50960
  if (next2) {
50658
- addClass(next2, ...styles);
50961
+ addClass(next2, ...styles2);
50659
50962
  }
50660
50963
  }
50661
50964
  async function requestMindmapFullscreen(editor, block, mindmapTools) {
@@ -51643,7 +51946,7 @@ ${codeText}
51643
51946
  html = `<input type="checkbox" disabled="disabled" /> ${html}`;
51644
51947
  }
51645
51948
  let listTag = "ul";
51646
- let styles = "";
51949
+ let styles2 = "";
51647
51950
  if (list2.ordered) {
51648
51951
  html = `<li value="${list2.start}">${html}</li>`;
51649
51952
  listTag = "ol";
@@ -51651,18 +51954,18 @@ ${codeText}
51651
51954
  case 2:
51652
51955
  case 5:
51653
51956
  case 8:
51654
- styles = "list-style-type: lower-alpha;";
51957
+ styles2 = "list-style-type: lower-alpha;";
51655
51958
  break;
51656
51959
  case 3:
51657
51960
  case 6:
51658
- styles = "list-style-type: lower-roman;";
51961
+ styles2 = "list-style-type: lower-roman;";
51659
51962
  break;
51660
51963
  }
51661
51964
  } else {
51662
51965
  html = `<li>${html}</li>`;
51663
51966
  }
51664
51967
  if (isFirstListItem(editor, blockData, doc2, path)) {
51665
- html = `<${listTag}${styles ? ` style="${styles}"` : ""}>${html}`;
51968
+ html = `<${listTag}${styles2 ? ` style="${styles2}"` : ""}>${html}`;
51666
51969
  }
51667
51970
  if (isLastListItem(editor, blockData, doc2, path)) {
51668
51971
  html = `${html}</${listTag}>`;
@@ -62591,13 +62894,13 @@ $$${mathData.mathjaxText}$$
62591
62894
  if (!op.attributes) {
62592
62895
  return /* @__PURE__ */ new Map();
62593
62896
  }
62594
- const styles = Object.entries(op.attributes).filter(([key]) => {
62897
+ const styles2 = Object.entries(op.attributes).filter(([key]) => {
62595
62898
  if (key.startsWith("style-")) {
62596
62899
  return true;
62597
62900
  }
62598
62901
  return false;
62599
62902
  });
62600
- return new Map(styles);
62903
+ return new Map(styles2);
62601
62904
  };
62602
62905
  if (text2.length === 0) {
62603
62906
  return /* @__PURE__ */ new Map();
@@ -62641,11 +62944,11 @@ $$${mathData.mathjaxText}$$
62641
62944
  if (getTextLength(text2) === 0) {
62642
62945
  return textStyles;
62643
62946
  }
62644
- let styles = getIntersectionStyles(text2);
62645
- styles = mergeActiveStyle(editor, styles);
62947
+ let styles2 = getIntersectionStyles(text2);
62948
+ styles2 = mergeActiveStyle(editor, styles2);
62646
62949
  function getTextStyle(item) {
62647
62950
  const { id, icon, desc, name } = item;
62648
- const value = styles.get(id);
62951
+ const value = styles2.get(id);
62649
62952
  if (value !== void 0) {
62650
62953
  return {
62651
62954
  id,
@@ -63241,6 +63544,7 @@ $$${mathData.mathjaxText}$$
63241
63544
  GroupItemActions2["QuickReply"] = "quick-reply";
63242
63545
  GroupItemActions2["QuickReplyOk"] = "quick-reply-ok";
63243
63546
  GroupItemActions2["QuickReplyCancel"] = "quick-reply-cancel";
63547
+ GroupItemActions2["Resolve"] = "resolve";
63244
63548
  return GroupItemActions2;
63245
63549
  })(GroupItemActions || {});
63246
63550
  const GROUP_ITEM_ACTION_MARK = "group-item-action";
@@ -63288,7 +63592,7 @@ $$${mathData.mathjaxText}$$
63288
63592
  return attributes.filter((attribute) => attribute.startsWith("comment-")).map((attribute) => attribute.replace("comment-", ""));
63289
63593
  }
63290
63594
  const logger$1G = getLogger("doc-comments");
63291
- function addBlockComments(doc2, block, result, resultSet) {
63595
+ function addBlockComments$1(doc2, block, result, resultSet) {
63292
63596
  if (block.comments) {
63293
63597
  const blockComments = block.comments;
63294
63598
  if (Array.isArray(blockComments)) {
@@ -63324,7 +63628,7 @@ $$${mathData.mathjaxText}$$
63324
63628
  children.forEach((childContainerId) => {
63325
63629
  const childBlocks = doc2.blocks[childContainerId];
63326
63630
  childBlocks.forEach((subBlock) => {
63327
- addBlockComments(doc2, subBlock, result, resultSet);
63631
+ addBlockComments$1(doc2, subBlock, result, resultSet);
63328
63632
  });
63329
63633
  });
63330
63634
  }
@@ -63332,7 +63636,7 @@ $$${mathData.mathjaxText}$$
63332
63636
  const result = [];
63333
63637
  const resultSet = /* @__PURE__ */ new Set();
63334
63638
  doc2.blocks.root.forEach((block) => {
63335
- addBlockComments(doc2, block, result, resultSet);
63639
+ addBlockComments$1(doc2, block, result, resultSet);
63336
63640
  });
63337
63641
  const resultMap = /* @__PURE__ */ new Map();
63338
63642
  result.forEach((commentId, index2) => resultMap.set(commentId, index2));
@@ -63388,6 +63692,26 @@ $$${mathData.mathjaxText}$$
63388
63692
  });
63389
63693
  return result;
63390
63694
  }
63695
+ function getUnresolvedCommentsGroupFromDoc(editor, commentsProvider) {
63696
+ return getCommentsGroupFromDoc(editor, commentsProvider).filter((group) => !group.resolver);
63697
+ }
63698
+ function getResolvedCommentsGroupFromDoc(editor, commentsProvider) {
63699
+ const doc2 = editor.doc.toJSON();
63700
+ const commentsMap = getCommentsFromDoc(doc2);
63701
+ const commentGroup = getCommentsGroup(commentsProvider.getComments());
63702
+ const result = commentGroup.filter((group) => group.resolver).sort((group1, group2) => {
63703
+ var _a, _b, _c, _d;
63704
+ const date1 = (_b = (_a = group1.resolver) == null ? void 0 : _a.date) != null ? _b : 0;
63705
+ const date2 = (_d = (_c = group2.resolver) == null ? void 0 : _c.date) != null ? _d : 0;
63706
+ return date2 - date1;
63707
+ });
63708
+ result.forEach((group) => {
63709
+ if (!commentsMap.has(group.groupId)) {
63710
+ group.removedFromDoc = true;
63711
+ }
63712
+ });
63713
+ return result;
63714
+ }
63391
63715
  function flattenCommentGroup(comment) {
63392
63716
  const { children, ...raw } = comment;
63393
63717
  const comments = [raw];
@@ -63397,9 +63721,12 @@ $$${mathData.mathjaxText}$$
63397
63721
  return comments;
63398
63722
  }
63399
63723
  function getCommentsCountInDoc(editor, commentsProvider) {
63400
- const commentGroups = getCommentsGroupFromDoc(editor, commentsProvider);
63401
- const count = commentGroups.length;
63402
- return count;
63724
+ const unresolved = getUnresolvedCommentsGroupFromDoc(editor, commentsProvider).length;
63725
+ const commentsGroup = getCommentsGroup(commentsProvider.getComments());
63726
+ const resolved = commentsGroup.filter((group) => group.resolver).length;
63727
+ const total = unresolved + resolved;
63728
+ logger$1G.debug(`total comments: ${total}, unresolved: ${unresolved}, resolved: ${resolved}`);
63729
+ return total;
63403
63730
  }
63404
63731
  function getCommentsFromPos(editor, pos) {
63405
63732
  const commentIds = [];
@@ -63444,6 +63771,24 @@ $$${mathData.mathjaxText}$$
63444
63771
  const commentIds = intersection__default.default(comments1, comments2);
63445
63772
  return commentIds;
63446
63773
  }
63774
+ function removeUnresolvedComments(commentProvider, commentIds) {
63775
+ return commentIds.filter((commentId) => {
63776
+ const comment = commentProvider.getComment(commentId);
63777
+ if (!comment) {
63778
+ return false;
63779
+ }
63780
+ return !!comment.resolver;
63781
+ });
63782
+ }
63783
+ function removeResolvedComments(commentProvider, commentIds) {
63784
+ return commentIds.filter((commentId) => {
63785
+ const comment = commentProvider.getComment(commentId);
63786
+ if (!comment) {
63787
+ return false;
63788
+ }
63789
+ return !(comment == null ? void 0 : comment.resolver);
63790
+ });
63791
+ }
63447
63792
  const logger$1F = getLogger("active-comments");
63448
63793
  function inactiveComment(editor, commentId) {
63449
63794
  const activeCommentElements = editor.rootContainer.querySelectorAll(`span.comment[comment-${commentId}],[data-type=editor-block].comment[comment-${commentId}]`);
@@ -63499,6 +63844,11 @@ $$${mathData.mathjaxText}$$
63499
63844
  }
63500
63845
  }
63501
63846
  }
63847
+ function getElementsByCommentId(editor, commentId) {
63848
+ const lowerCommentId = commentId.toLocaleLowerCase();
63849
+ const elements = editor.rootContainer.querySelectorAll(`span.comment[comment-${lowerCommentId}],[data-type=editor-block].comment[comment-${lowerCommentId}]`);
63850
+ return Array.from(elements);
63851
+ }
63502
63852
  function isImageBlock(block) {
63503
63853
  return getBlockType(block) === "embed" && getEmbedType(block) === "image";
63504
63854
  }
@@ -69303,8 +69653,9 @@ ${codeText}
69303
69653
  return items;
69304
69654
  }
69305
69655
  reloadList(data2) {
69656
+ this._items.forEach((item) => item.destroy());
69306
69657
  this.container.innerHTML = "";
69307
- this.createList(data2);
69658
+ this._items = this.createList(data2);
69308
69659
  }
69309
69660
  insertItem(data2) {
69310
69661
  const index2 = this.findInsertPos(data2);
@@ -69377,8 +69728,8 @@ ${codeText}
69377
69728
  });
69378
69729
  }
69379
69730
  }
69380
- const switchUpIcon = '<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M2.00218 11.0005L8.00341 4.99923L14.0046 11.0005" stroke="currentColor" fill="transparent" stroke-width="1.5" stroke-linejoin="bevel"/>\n</svg>';
69381
- const switchDownIcon = '<svg width="17" height="16" viewBox="0 0 17 16" xmlns="http://www.w3.org/2000/svg">\n<path d="M14.0029 4.99933L8.00172 11.0006L2.00049 4.99933" stroke="currentColor" fill="transparent" stroke-width="1.5" stroke-linejoin="bevel"/>\n</svg>';
69731
+ const switchUpIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M4.17757 10.2343L7.99993 6.41191L11.8208 10.2343" stroke="currentColor"/>\n</svg>\n';
69732
+ const switchDownIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M4.17757 5.76573L7.99993 9.58809L11.8208 5.76573" stroke="currentColor"/>\n</svg>\n';
69382
69733
  const index$8 = "";
69383
69734
  const REPLY_EDITOR_EDITING_CLS = "reply-editor-editing";
69384
69735
  const { t: t$3 } = i18n$1;
@@ -69501,6 +69852,9 @@ ${codeText}
69501
69852
  __publicField(this, "quickReply");
69502
69853
  __publicField(this, "createRoot", () => {
69503
69854
  const root2 = createElement("div", ["comment-group-item-root"], null);
69855
+ if (this.comment.resolver) {
69856
+ addClass(root2, "resolved");
69857
+ }
69504
69858
  return root2;
69505
69859
  });
69506
69860
  __publicField(this, "createChildrenList", () => {
@@ -69557,6 +69911,7 @@ ${codeText}
69557
69911
  this.mainItem = this.createItem();
69558
69912
  this.childrenList = this.createChildrenList();
69559
69913
  this.quickReply = this.createQuickReply();
69914
+ this.createFooter();
69560
69915
  this.editor.on("readonlyChanged", this.handleReadonlyChanged);
69561
69916
  this.resizeObserver = new index$g(this.handleResize);
69562
69917
  this.resizeObserver.observe(this.root);
@@ -69566,9 +69921,49 @@ ${codeText}
69566
69921
  const count = getCommentItemCountInGroupItem(this.root);
69567
69922
  return count;
69568
69923
  }
69924
+ createFooter() {
69925
+ if (!this.comment.resolver) {
69926
+ return null;
69927
+ }
69928
+ const footer = createElement("div", ["comment-item-footer"], this.root);
69929
+ const resolved = createElement("span", ["comment-resolved"], footer);
69930
+ const date = new Date(this.comment.modified);
69931
+ const resolver = this.comment.resolver;
69932
+ assert(logger$1h, resolver, "resolver should not be null");
69933
+ const html = i18n$1.t("comment.resolvedBy", { name: resolver.displayName, date: fromNowString(date) });
69934
+ resolved.innerHTML = html;
69935
+ const actions2 = createElement("div", ["comment-actions"], footer);
69936
+ createElement("span", ["comment-date"], actions2, fromNowString(new Date(resolver.date)));
69937
+ if (this.comment.removedFromDoc) {
69938
+ createElement("span", ["removed-tips"], actions2, i18n$1.t("comment.removedFromDoc"));
69939
+ } else {
69940
+ const reopen = createElement("button", ["comment-reopen"], actions2, i18n$1.t("comment.reopen"));
69941
+ reopen.onclick = () => {
69942
+ const editor = this.editor;
69943
+ const doc2 = editor.doc.toJSON();
69944
+ const commentsMap = getCommentsFromDoc(doc2);
69945
+ if (!commentsMap.has(this.comment.groupId)) {
69946
+ showToast(i18n$1.t("comment.commentHasAlreadyRemoved"), {
69947
+ position: {
69948
+ y: 30,
69949
+ x: window.innerWidth / 2
69950
+ },
69951
+ theme: "warn"
69952
+ });
69953
+ return;
69954
+ }
69955
+ this.commentsProvider.localUpdateCommentResolver(this.comment.id, void 0);
69956
+ };
69957
+ }
69958
+ return footer;
69959
+ }
69569
69960
  createQuickReply() {
69570
69961
  const { editor, commentsProvider, comment } = this;
69571
69962
  const commentQuickReply = new CommentQuickReply(editor, commentsProvider, comment, this);
69963
+ const commentOptions = this.editor.getComponentOptions("comment");
69964
+ if (commentOptions == null ? void 0 : commentOptions.disableReply) {
69965
+ commentQuickReply.root.classList.add("hidden");
69966
+ }
69572
69967
  this.root.append(commentQuickReply.root);
69573
69968
  return commentQuickReply;
69574
69969
  }
@@ -69580,8 +69975,15 @@ ${codeText}
69580
69975
  const switchContainer = createElement("span", ["item-head-switch"], head);
69581
69976
  const switchUp = createTextButton(switchContainer, GroupItemActions.SwitchUp, "up", switchUpIcon);
69582
69977
  const switchDown = createTextButton(switchContainer, GroupItemActions.SwitchDown, "down", switchDownIcon);
69978
+ const resolve = createTextButton(switchContainer, GroupItemActions.Resolve, "resolve", CircleCheckMarkIcon);
69583
69979
  addGroupActionToElement(switchUp, GroupItemActions.SwitchUp);
69584
69980
  addGroupActionToElement(switchDown, GroupItemActions.SwitchDown);
69981
+ addGroupActionToElement(resolve, GroupItemActions.Resolve);
69982
+ resolve.setAttribute(`data-editor-tooltip-${this.editor.clientId}`, i18n$1.t("comment.resolveComment"));
69983
+ addClass(resolve, "disable-active");
69984
+ if (comment.resolver) {
69985
+ addClass(resolve, "resolved");
69986
+ }
69585
69987
  return head;
69586
69988
  }
69587
69989
  createItem() {
@@ -69621,6 +70023,7 @@ ${codeText}
69621
70023
  handleUpdateMainComment(comment) {
69622
70024
  assert(logger$1h, comment.id === this.mainItem.comment.id, "invalid comment");
69623
70025
  this.mainItem.reloadDoc();
70026
+ this.setCreatingComment(false);
69624
70027
  }
69625
70028
  deleteMainComment(commentId) {
69626
70029
  assert(logger$1h, commentId === this.mainItem.comment.id, "invalid comment");
@@ -69629,6 +70032,18 @@ ${codeText}
69629
70032
  edit() {
69630
70033
  this.mainItem.edit();
69631
70034
  }
70035
+ setCreatingComment(creating) {
70036
+ const resolveButton = this.header.querySelector('.editor-text-button[group-item-action="resolve"]');
70037
+ if (!resolveButton) {
70038
+ return;
70039
+ }
70040
+ resolveButton.disabled = creating;
70041
+ if (creating) {
70042
+ resolveButton.classList.add("disabled");
70043
+ } else {
70044
+ resolveButton.classList.remove("disabled");
70045
+ }
70046
+ }
69632
70047
  destroy() {
69633
70048
  this.quickReply.destroy();
69634
70049
  this.mainItem.destroy();
@@ -69814,7 +70229,21 @@ ${codeText}
69814
70229
  this.commentsProvider.localDeleteComment(comment.id);
69815
70230
  quickReply.show();
69816
70231
  });
69817
- __publicField(this, "execute", (element, groupItem, commentId, itemIndex) => {
70232
+ __publicField(this, "handleResolve", (groupItem) => {
70233
+ var _a;
70234
+ const { commentsProvider } = this;
70235
+ let comment = commentsProvider.getComment(groupItem.comment.id);
70236
+ if (!comment) {
70237
+ comment = (_a = groupItem.childrenList.items[0]) == null ? void 0 : _a.comment;
70238
+ }
70239
+ const user = this.groupList.editor.doc.getUser();
70240
+ commentsProvider.localUpdateCommentResolver(comment.id, {
70241
+ userId: user.userId,
70242
+ displayName: user.displayName,
70243
+ date: Date.now()
70244
+ });
70245
+ });
70246
+ __publicField(this, "execute", (element, groupItem, commentId, itemIndex, event) => {
69818
70247
  const actionElement = getClosestGroupItemActionElement(element);
69819
70248
  if (!actionElement)
69820
70249
  return;
@@ -69853,6 +70282,11 @@ ${codeText}
69853
70282
  case GroupItemActions.QuickReplyCancel:
69854
70283
  this.handleQuickReplyCancel(groupItem);
69855
70284
  break;
70285
+ case GroupItemActions.Resolve:
70286
+ event.preventDefault();
70287
+ event.stopPropagation();
70288
+ this.handleResolve(groupItem);
70289
+ break;
69856
70290
  default:
69857
70291
  const exhaustiveCheck = actionId;
69858
70292
  logger$1f.debug(`not implement handler for ${exhaustiveCheck}`);
@@ -69866,8 +70300,8 @@ ${codeText}
69866
70300
  }
69867
70301
  const logger$1e = getLogger("comment-group-list");
69868
70302
  class CommentGroupList extends ListBase {
69869
- constructor(editor, commentsProvider, parent) {
69870
- super(editor, commentsProvider, parent, getCommentsGroupFromDoc(editor, commentsProvider), {});
70303
+ constructor(editor, commentsProvider, parent, type) {
70304
+ super(editor, commentsProvider, parent, getUnresolvedCommentsGroupFromDoc(editor, commentsProvider), {});
69871
70305
  __publicField(this, "groupItemHandlers");
69872
70306
  __publicField(this, "dispatchScroll", debounce__default.default(() => {
69873
70307
  this.editor.scrollContainer.dispatchEvent(new Event("scroll"));
@@ -69905,7 +70339,9 @@ ${codeText}
69905
70339
  const commentId = getClosestCommentItemId(event.target);
69906
70340
  const index2 = this.items.findIndex((item) => item.root === itemRoot);
69907
70341
  if (index2 !== -1) {
69908
- if (this.activeIndex !== index2) {
70342
+ const disableActive = !!event.target.closest(".disable-active");
70343
+ const enableActive = !disableActive;
70344
+ if (this.activeIndex !== index2 && enableActive) {
69909
70345
  this.setActiveItem(index2);
69910
70346
  }
69911
70347
  const { groupItemHandlers } = this;
@@ -69913,7 +70349,8 @@ ${codeText}
69913
70349
  event.target,
69914
70350
  this.items[index2],
69915
70351
  commentId,
69916
- index2
70352
+ index2,
70353
+ event
69917
70354
  );
69918
70355
  }
69919
70356
  });
@@ -69954,7 +70391,10 @@ ${codeText}
69954
70391
  __publicField(this, "handleSelectionChanged", () => {
69955
70392
  setTimeout(() => {
69956
70393
  var _a;
69957
- const commentIds = getCommentsFromSelection(this.editor);
70394
+ if (this.type !== "current") {
70395
+ return;
70396
+ }
70397
+ const commentIds = this.type === "current" ? removeResolvedComments(this.commentsProvider, getCommentsFromSelection(this.editor)) : removeUnresolvedComments(this.commentsProvider, getCommentsFromSelection(this.editor));
69958
70398
  if (commentIds.length > 0) {
69959
70399
  if (((_a = this.activeItem) == null ? void 0 : _a.comment.id) && commentIds.includes(this.activeItem.comment.id)) {
69960
70400
  return;
@@ -69995,7 +70435,9 @@ ${codeText}
69995
70435
  const top = Number.parseFloat(firstItem.style.top);
69996
70436
  const targetTop = Number.parseFloat(firstItem.getAttribute("data-target-top") || "0");
69997
70437
  if (!Number.isNaN(top) && !Number.isNaN(targetTop) && top < targetTop) {
69998
- arrangeItems(this.editor, this.items, null, Math.min(top + (0 - event.deltaY) * 3, targetTop));
70438
+ if (this.type === "current") {
70439
+ arrangeItems(this.editor, this.items, null, Math.min(top + (0 - event.deltaY) * 3, targetTop));
70440
+ }
69999
70441
  }
70000
70442
  });
70001
70443
  __publicField(this, "updateGroupItemSwitch", () => {
@@ -70004,7 +70446,7 @@ ${codeText}
70004
70446
  activeItem.updateSwitchButton();
70005
70447
  });
70006
70448
  __publicField(this, "updateComments", debounce__default.default(() => {
70007
- const commentsGroup = getCommentsGroupFromDoc(this.editor, this.commentsProvider);
70449
+ const commentsGroup = this.type === "current" ? getUnresolvedCommentsGroupFromDoc(this.editor, this.commentsProvider) : getResolvedCommentsGroupFromDoc(this.editor, this.commentsProvider);
70008
70450
  let hasBeenChanged = false;
70009
70451
  for (let i = 0; i < commentsGroup.length; i++) {
70010
70452
  const comment = commentsGroup[i];
@@ -70027,6 +70469,8 @@ ${codeText}
70027
70469
  this.emit("commentCountChanged");
70028
70470
  }
70029
70471
  }, 100));
70472
+ this.editor = editor;
70473
+ this.type = type;
70030
70474
  this.updateItemsLayout();
70031
70475
  this.bindEvents();
70032
70476
  this.editor.addListener("selectionChanged", this.handleSelectionChanged);
@@ -70047,7 +70491,9 @@ ${codeText}
70047
70491
  document.removeEventListener("click", this.handleDocumentClick);
70048
70492
  }
70049
70493
  updateItemsLayout(dispatchScroll = true) {
70050
- arrangeItems(this.editor, this.items, this.activeItem);
70494
+ if (this.type === "current") {
70495
+ arrangeItems(this.editor, this.items, this.activeItem);
70496
+ }
70051
70497
  if (dispatchScroll) {
70052
70498
  this.dispatchScroll();
70053
70499
  }
@@ -70071,7 +70517,7 @@ ${codeText}
70071
70517
  return item;
70072
70518
  }
70073
70519
  findInsertPos(data2) {
70074
- const commentsMap = getCommentsGroupFromDoc(this.editor, this.commentsProvider);
70520
+ const commentsMap = getUnresolvedCommentsGroupFromDoc(this.editor, this.commentsProvider);
70075
70521
  const index2 = commentsMap.findIndex((group) => group.id === data2.id);
70076
70522
  if (index2 === -1) {
70077
70523
  return -1;
@@ -70171,6 +70617,7 @@ ${codeText}
70171
70617
  newItem.quickReply.hide();
70172
70618
  setTimeout(() => {
70173
70619
  newItem.edit();
70620
+ newItem.setCreatingComment(true);
70174
70621
  }, 300);
70175
70622
  }
70176
70623
  }
@@ -70195,6 +70642,18 @@ ${codeText}
70195
70642
  }
70196
70643
  }
70197
70644
  }
70645
+ handleResolveComment(commentId) {
70646
+ const item = this.findItem(commentId);
70647
+ if (item) {
70648
+ this.deleteItem(item.comment.id);
70649
+ }
70650
+ }
70651
+ removeGroupItem(comment) {
70652
+ const item = this.findItem(comment.id) || this.findItem(comment.groupId);
70653
+ if (item) {
70654
+ this.deleteItem(item.comment.id);
70655
+ }
70656
+ }
70198
70657
  handleUpdateComment(comment) {
70199
70658
  const group = this.findItemAsGroupId(comment.groupId);
70200
70659
  if (group && group.comment.id !== comment.id) {
@@ -70206,6 +70665,236 @@ ${codeText}
70206
70665
  item.handleUpdateMainComment(comment);
70207
70666
  }
70208
70667
  }
70668
+ changeType(type) {
70669
+ this.type = type;
70670
+ const comments = this.type === "current" ? getUnresolvedCommentsGroupFromDoc(this.editor, this.commentsProvider) : getResolvedCommentsGroupFromDoc(this.editor, this.commentsProvider);
70671
+ this.reloadList(comments);
70672
+ if (this.type === "current") {
70673
+ setTimeout(() => {
70674
+ arrangeItems(this.editor, this.items, null);
70675
+ });
70676
+ }
70677
+ }
70678
+ reloadList(data2) {
70679
+ super.reloadList(data2);
70680
+ this._items.forEach((item) => item.addListener("resize", this.handleItemResize));
70681
+ }
70682
+ }
70683
+ function addBlockComments(doc2, block, resultMap) {
70684
+ if (block.comments) {
70685
+ const blockComments = block.comments;
70686
+ if (Array.isArray(blockComments)) {
70687
+ blockComments.forEach((commentId) => {
70688
+ const commentIds = resultMap.get(block.id);
70689
+ if (commentIds) {
70690
+ commentIds.add(commentId);
70691
+ } else {
70692
+ resultMap.set(block.id, /* @__PURE__ */ new Set([commentId]));
70693
+ }
70694
+ });
70695
+ }
70696
+ }
70697
+ if (block.text) {
70698
+ const text2 = block.text;
70699
+ text2.forEach((op) => {
70700
+ if (op.attributes) {
70701
+ const prefix = "comment-";
70702
+ Object.entries(op.attributes).forEach(([key, value]) => {
70703
+ if (key.startsWith(prefix)) {
70704
+ const commentId = value;
70705
+ const commentIds = resultMap.get(block.id);
70706
+ if (commentIds) {
70707
+ commentIds.add(commentId);
70708
+ } else {
70709
+ resultMap.set(block.id, /* @__PURE__ */ new Set([commentId]));
70710
+ }
70711
+ }
70712
+ });
70713
+ }
70714
+ });
70715
+ }
70716
+ const children = block.children;
70717
+ if (!children) {
70718
+ return;
70719
+ }
70720
+ children.forEach((childContainerId) => {
70721
+ const childBlocks = doc2.blocks[childContainerId];
70722
+ childBlocks.forEach((subBlock) => {
70723
+ addBlockComments(doc2, subBlock, resultMap);
70724
+ });
70725
+ });
70726
+ }
70727
+ function getBlockCommentsFromDoc(doc2) {
70728
+ const resultMap = /* @__PURE__ */ new Map();
70729
+ doc2.blocks.root.forEach((block) => {
70730
+ addBlockComments(doc2, block, resultMap);
70731
+ });
70732
+ return resultMap;
70733
+ }
70734
+ function getBlocksByCommentId(doc2, commentId) {
70735
+ const result = [];
70736
+ const resultMap = getBlockCommentsFromDoc(doc2);
70737
+ resultMap.forEach((commentIds, blockId) => {
70738
+ if (commentIds.has(commentId)) {
70739
+ result.push(blockId);
70740
+ }
70741
+ });
70742
+ return result;
70743
+ }
70744
+ class OnesEditorCommentsRender {
70745
+ constructor(type = "current") {
70746
+ __publicField(this, "updateUnknownCommentsDelayed", debounce__default.default((editor) => {
70747
+ const comments = this.getComments(editor);
70748
+ const invisibleComments = Object.values(comments).filter((comment) => {
70749
+ const ret = this.type === "current" ? !!comment.resolver : !comment.resolver;
70750
+ return ret;
70751
+ });
70752
+ const root2 = editor.rootContainer;
70753
+ const effectedElements = /* @__PURE__ */ new Set();
70754
+ invisibleComments.forEach((comment) => {
70755
+ const key = `comment-${comment.groupId.toLocaleLowerCase()}`;
70756
+ const elements = root2.querySelectorAll(`[${key}]`);
70757
+ elements.forEach((elem) => {
70758
+ elem.removeAttribute(key);
70759
+ effectedElements.add(elem);
70760
+ });
70761
+ });
70762
+ effectedElements.forEach((elem) => {
70763
+ const commentAttributes = Array.from(elem.attributes).filter((a) => a.name.startsWith("comment-"));
70764
+ if (commentAttributes.length === 0) {
70765
+ elem.classList.remove("comment");
70766
+ }
70767
+ });
70768
+ }));
70769
+ this.type = type;
70770
+ }
70771
+ renderText(editor, path, attributes) {
70772
+ const classes = [];
70773
+ const textAttributes = {};
70774
+ Object.entries(attributes).forEach(([key, value]) => {
70775
+ if (key.startsWith("comment-")) {
70776
+ this.renderCommentElement(editor, key, value, classes, textAttributes);
70777
+ }
70778
+ });
70779
+ return { classes, attributes: textAttributes };
70780
+ }
70781
+ renderBox(editor, path, attributes) {
70782
+ const classes = [];
70783
+ const textAttributes = {};
70784
+ Object.entries(attributes).forEach(([key, value]) => {
70785
+ if (key.startsWith("comment-")) {
70786
+ this.renderCommentElement(editor, key, value, classes, textAttributes);
70787
+ }
70788
+ });
70789
+ return { classes, attributes: textAttributes };
70790
+ }
70791
+ renderBlock(editor, path, blockData) {
70792
+ const comments = blockData.comments;
70793
+ if (!comments || comments.length === 0) {
70794
+ return {};
70795
+ }
70796
+ const classes = [];
70797
+ const attributes = {};
70798
+ comments.forEach((commentId) => {
70799
+ const key = `comment-${commentId.toLocaleLowerCase()}`;
70800
+ this.renderCommentElement(editor, key, commentId, classes, attributes);
70801
+ });
70802
+ return {
70803
+ classes,
70804
+ attributes
70805
+ };
70806
+ }
70807
+ updateBlock(editor, path, blockElement, blockData) {
70808
+ const comments = blockData.comments;
70809
+ removeClass(blockElement, "comment");
70810
+ Array.from(blockElement.attributes).forEach((a) => {
70811
+ if (a.name.startsWith("comment-")) {
70812
+ blockElement.removeAttribute(a.name);
70813
+ }
70814
+ });
70815
+ if (!comments || comments.length === 0) {
70816
+ return;
70817
+ }
70818
+ if (this.type === "resolved") {
70819
+ return;
70820
+ }
70821
+ addClass(blockElement, "comment");
70822
+ const classList = [];
70823
+ const attributes = {};
70824
+ comments.forEach((commentId) => {
70825
+ const key = `comment-${commentId.toLocaleLowerCase()}`;
70826
+ this.renderCommentElement(editor, key, commentId, classList, attributes);
70827
+ });
70828
+ Object.entries(attributes).forEach(([key, value]) => {
70829
+ blockElement.setAttribute(key, value);
70830
+ });
70831
+ if (classList.length > 0) {
70832
+ addClass(blockElement, ...classList);
70833
+ }
70834
+ }
70835
+ getCommentStatus(editor, commentId) {
70836
+ const comments = editor.findCustom("editor-comments");
70837
+ if (!comments) {
70838
+ return "unknown";
70839
+ }
70840
+ const commentsProvider = comments.commentProvider;
70841
+ const comment = commentsProvider.getComment(commentId);
70842
+ if (!comment) {
70843
+ return "unknown";
70844
+ }
70845
+ if (comment.resolver) {
70846
+ return "resolved";
70847
+ }
70848
+ return "unresolved";
70849
+ }
70850
+ renderCommentElement(editor, key, commentId, classes, textAttributes) {
70851
+ const status = this.getCommentStatus(editor, commentId);
70852
+ if (this.type === "current") {
70853
+ if (status === "resolved") {
70854
+ return;
70855
+ }
70856
+ } else {
70857
+ return;
70858
+ }
70859
+ classes.push("comment");
70860
+ textAttributes[key] = commentId;
70861
+ if (status === "unknown") {
70862
+ this.updateUnknownCommentsDelayed(editor);
70863
+ }
70864
+ }
70865
+ getComments(editor) {
70866
+ const editorComments = editor.findCustom("editor-comments");
70867
+ if (!editorComments) {
70868
+ return [];
70869
+ }
70870
+ const commentProvider = editorComments.commentProvider;
70871
+ return commentProvider.getComments();
70872
+ }
70873
+ changeType(editor, type) {
70874
+ this.type = type;
70875
+ const elements = editor.rootContainer.querySelectorAll(".comment");
70876
+ elements.forEach((elem) => {
70877
+ elem.classList.remove("comment");
70878
+ Array.from(elem.attributes).forEach((a) => {
70879
+ if (a.name.startsWith("comment-")) {
70880
+ elem.removeAttribute(a.name);
70881
+ }
70882
+ });
70883
+ });
70884
+ const comments = this.getComments(editor);
70885
+ const resolvedCommentsId = new Set(Object.values(comments).filter((comment) => !!comment.resolver).map((comment) => comment.groupId));
70886
+ const unresolvedCommentsId = new Set(Object.values(comments).filter((comment) => !resolvedCommentsId.has(comment.groupId)).map((comment) => comment.groupId));
70887
+ const visibleCommentsId = type === "current" ? unresolvedCommentsId : resolvedCommentsId;
70888
+ const commentsFromDoc = getBlockCommentsFromDoc(editor.doc.toJSON());
70889
+ commentsFromDoc.forEach((commentIds, blockId) => {
70890
+ if (Array.from(commentIds).some((c) => visibleCommentsId.has(c))) {
70891
+ const block = editor.findBlockById(blockId);
70892
+ if (block) {
70893
+ editor.reloadBlock(block);
70894
+ }
70895
+ }
70896
+ });
70897
+ }
70209
70898
  }
70210
70899
  const COMMENT_MINI_CLS = "comment-mini";
70211
70900
  getLogger("comment-list");
@@ -70215,6 +70904,46 @@ ${codeText}
70215
70904
  __publicField(this, "root");
70216
70905
  __publicField(this, "groupsContainer");
70217
70906
  __publicField(this, "list");
70907
+ __publicField(this, "listType", "current");
70908
+ __publicField(this, "switcherItem", {
70909
+ id: "switch-comment",
70910
+ name: i18n$1.t("comment.currentComment"),
70911
+ dropdown: true,
70912
+ manualShowChildren: true,
70913
+ childrenPlacement: "bottom-start",
70914
+ children: [{
70915
+ id: "current-comment",
70916
+ name: i18n$1.t("comment.currentComment"),
70917
+ states: ["checked"]
70918
+ }, {
70919
+ id: "resolved-comment",
70920
+ name: i18n$1.t("comment.resolvedComment")
70921
+ }]
70922
+ });
70923
+ __publicField(this, "switcherBar");
70924
+ __publicField(this, "noCommentTip", null);
70925
+ __publicField(this, "handleSwitchType", (bar2, item) => {
70926
+ var _a, _b;
70927
+ if (item.id === "current-comment") {
70928
+ this.listType = "current";
70929
+ } else {
70930
+ this.listType = "resolved";
70931
+ }
70932
+ this.editor.rootContainer.setAttribute("comment-list-type", this.listType);
70933
+ this.root.setAttribute("list-type", this.listType);
70934
+ this.switcherItem.name = this.listType === "current" ? i18n$1.t("comment.currentComment") : i18n$1.t("comment.resolvedComment");
70935
+ const children = this.switcherItem.children;
70936
+ children[0].states = this.listType === "current" ? ["checked"] : [];
70937
+ children[1].states = this.listType === "resolved" ? ["checked"] : [];
70938
+ this.switcherBar.updateItems([this.switcherItem]);
70939
+ this.list.changeType(this.listType);
70940
+ const renderer = this.editor.editorBlockRenders.getRenderers().find((r) => r instanceof OnesEditorCommentsRender);
70941
+ if (renderer) {
70942
+ renderer.changeType(this.editor, this.listType);
70943
+ }
70944
+ this.updateCommentCountTip();
70945
+ (_b = (_a = this.commentOptions) == null ? void 0 : _a.onCommentListTypeChange) == null ? void 0 : _b.call(_a, this.editor, this.listType);
70946
+ });
70218
70947
  __publicField(this, "handleSelectionOnComment", () => {
70219
70948
  this.emit("onSelectComment");
70220
70949
  });
@@ -70222,8 +70951,12 @@ ${codeText}
70222
70951
  var _a, _b;
70223
70952
  const count = getCommentsCountInDoc(this.editor, this.commentsProvider);
70224
70953
  (_b = (_a = this.commentOptions) == null ? void 0 : _a.onCommentCountChange) == null ? void 0 : _b.call(_a, count);
70954
+ this.updateCommentCountTip();
70225
70955
  });
70226
70956
  __publicField(this, "handleActiveItemChanged", (index2, direction) => {
70957
+ if (this.listType === "resolved") {
70958
+ return;
70959
+ }
70227
70960
  setTimeout(() => {
70228
70961
  var _a, _b;
70229
70962
  const item = this.list.activeItem;
@@ -70240,13 +70973,19 @@ ${codeText}
70240
70973
  this.editor = editor;
70241
70974
  this.commentsProvider = commentsProvider;
70242
70975
  this.root = createElement("div", ["editor-web-comment-root"], null);
70976
+ this.root.setAttribute("list-type", this.listType);
70243
70977
  this.groupsContainer = createElement("div", ["comment-groups-container"], this.root);
70244
70978
  this.list = this.createList();
70979
+ this.switcherBar = this.createSwitcher();
70245
70980
  this.commentsProvider.addListener(this);
70246
70981
  this.list.addListener("activeItemChanged", this.handleActiveItemChanged);
70247
70982
  this.list.addListener("itemLayoutUpdated", this.handleItemLayoutUpdated);
70248
70983
  this.list.addListener("selectionOnComment", this.handleSelectionOnComment);
70249
70984
  this.list.addListener("commentCountChanged", this.updateCommentCount);
70985
+ if (!this.editor.options.enableResolveComments) {
70986
+ this.root.classList.add("disable-resolve");
70987
+ }
70988
+ this.editor.rootContainer.setAttribute("comment-list-type", this.listType);
70250
70989
  this.updateCommentCount();
70251
70990
  }
70252
70991
  get commentOptions() {
@@ -70254,10 +70993,13 @@ ${codeText}
70254
70993
  return commentOptions;
70255
70994
  }
70256
70995
  destroy() {
70996
+ var _a;
70257
70997
  this.list.removeAllListeners();
70258
70998
  this.commentsProvider.removeListener(this);
70259
70999
  this.list.destroy();
70260
71000
  this.root.remove();
71001
+ this.switcherBar.destroy();
71002
+ (_a = this.noCommentTip) == null ? void 0 : _a.remove();
70261
71003
  }
70262
71004
  onCreateComment(commentId, local) {
70263
71005
  const comment = this.commentsProvider.getComment(commentId);
@@ -70272,8 +71014,73 @@ ${codeText}
70272
71014
  const comment = this.commentsProvider.getComment(commentId);
70273
71015
  this.list.handleUpdateComment(comment);
70274
71016
  }
71017
+ onUpdateCommentResolver(commentId, local) {
71018
+ const comment = this.commentsProvider.getComment(commentId);
71019
+ if (!comment) {
71020
+ return;
71021
+ }
71022
+ let type = "add";
71023
+ if (this.listType === "current") {
71024
+ if (comment.resolver) {
71025
+ type = "remove";
71026
+ }
71027
+ } else {
71028
+ if (!comment.resolver) {
71029
+ type = "remove";
71030
+ }
71031
+ }
71032
+ const blocks = /* @__PURE__ */ new Set();
71033
+ if (type === "remove") {
71034
+ getElementsByCommentId(this.editor, comment.groupId).forEach((element) => {
71035
+ if (isBlock$1(element)) {
71036
+ blocks.add(element);
71037
+ } else {
71038
+ const block = getParentBlock(element);
71039
+ if (block) {
71040
+ blocks.add(block);
71041
+ }
71042
+ }
71043
+ });
71044
+ } else {
71045
+ const blockIds = getBlocksByCommentId(this.editor.doc.toJSON(), comment.groupId);
71046
+ blockIds.forEach((blockId) => {
71047
+ const block = this.editor.findBlockById(blockId);
71048
+ if (block) {
71049
+ blocks.add(block);
71050
+ }
71051
+ });
71052
+ }
71053
+ blocks.forEach((block) => {
71054
+ this.editor.reloadBlock(block);
71055
+ });
71056
+ const commentGroup = getCommentsGroup(this.commentsProvider.getComments());
71057
+ const commentWithChildren = commentGroup.find((group) => group.groupId === comment.groupId);
71058
+ if (!commentWithChildren) {
71059
+ return;
71060
+ }
71061
+ setTimeout(() => {
71062
+ if (type === "add") {
71063
+ this.list.handleCreateComment(commentWithChildren, local);
71064
+ } else {
71065
+ this.list.removeGroupItem(comment);
71066
+ }
71067
+ this.updateCommentCount();
71068
+ }, 300);
71069
+ }
70275
71070
  createList() {
70276
- return new CommentGroupList(this.editor, this.commentsProvider, this.groupsContainer);
71071
+ return new CommentGroupList(this.editor, this.commentsProvider, this.groupsContainer, this.listType);
71072
+ }
71073
+ createSwitcher() {
71074
+ const container = createElement("div", ["comment-switcher-container"], this.root);
71075
+ const commandBar2 = new FixedToolbar(container, [this.switcherItem], {
71076
+ id: "comment-switcher"
71077
+ });
71078
+ commandBar2.addListener("click", this.handleSwitchType);
71079
+ return commandBar2;
71080
+ }
71081
+ setSwitcherParent(parent) {
71082
+ this.switcherBar.content.remove();
71083
+ parent.append(this.switcherBar.content);
70277
71084
  }
70278
71085
  isEditing(includeEmpty) {
70279
71086
  return this.list.isEditing(includeEmpty);
@@ -70281,14 +71088,49 @@ ${codeText}
70281
71088
  setFirstEditingCommentActive() {
70282
71089
  this.list.setFirstEditingCommentActive();
70283
71090
  }
70284
- show(groupId) {
71091
+ getListType() {
71092
+ return this.listType;
71093
+ }
71094
+ setListType(type) {
71095
+ var _a, _b;
71096
+ if (type === "resolved") {
71097
+ const item = (_a = this.switcherItem.children) == null ? void 0 : _a[1];
71098
+ this.handleSwitchType(this.switcherBar, item);
71099
+ } else {
71100
+ const item = (_b = this.switcherItem.children) == null ? void 0 : _b[0];
71101
+ this.handleSwitchType(this.switcherBar, item);
71102
+ }
71103
+ }
71104
+ updateCommentCountTip() {
70285
71105
  var _a;
71106
+ (_a = this.noCommentTip) == null ? void 0 : _a.remove();
71107
+ this.noCommentTip = null;
71108
+ if (this.listType === "resolved" && this.list.items.length === 0) {
71109
+ if (!this.noCommentTip) {
71110
+ this.noCommentTip = createElement("div", ["no-comment-tip"], this.groupsContainer);
71111
+ this.noCommentTip.innerText = i18n$1.t("comment.noResolvedComment");
71112
+ }
71113
+ return;
71114
+ }
71115
+ if (this.listType === "current" && this.list.items.length === 0) {
71116
+ if (!this.noCommentTip) {
71117
+ this.noCommentTip = createElement("div", ["no-comment-tip"], this.groupsContainer);
71118
+ this.noCommentTip.innerText = i18n$1.t("comment.noCurrentComment");
71119
+ }
71120
+ }
71121
+ }
71122
+ show(groupId) {
71123
+ var _a, _b;
70286
71124
  removeClass(this.root, "hidden");
70287
71125
  if (groupId) {
71126
+ if (this.listType !== "current") {
71127
+ const commandItem = (_a = this.switcherItem.children) == null ? void 0 : _a[0];
71128
+ this.handleSwitchType(this.switcherBar, commandItem);
71129
+ }
70288
71130
  const index2 = this.list.findItemIndex(groupId);
70289
71131
  this.list.setActiveItem(index2);
70290
71132
  }
70291
- (_a = this.commentOptions) == null ? void 0 : _a.controller.showCommentList();
71133
+ (_b = this.commentOptions) == null ? void 0 : _b.controller.showCommentList();
70292
71134
  }
70293
71135
  hide() {
70294
71136
  addClass(this.root, "hidden");
@@ -70416,7 +71258,7 @@ ${codeText}
70416
71258
  const logger$1c = getLogger("mobile-group-list");
70417
71259
  class MobileGroupList extends ListBase {
70418
71260
  constructor(editor, commentsProvider, parent, scrollElement) {
70419
- super(editor, commentsProvider, parent, getCommentsGroupFromDoc(editor, commentsProvider), {});
71261
+ super(editor, commentsProvider, parent, getUnresolvedCommentsGroupFromDoc(editor, commentsProvider), {});
70420
71262
  __publicField(this, "scroller");
70421
71263
  __publicField(this, "refreshScroller", () => {
70422
71264
  this.scroller.refresh();
@@ -70464,7 +71306,7 @@ ${codeText}
70464
71306
  this.updateComments();
70465
71307
  });
70466
71308
  __publicField(this, "updateComments", debounce__default.default(() => {
70467
- const commentsGroup = getCommentsGroupFromDoc(this.editor, this.commentsProvider);
71309
+ const commentsGroup = getUnresolvedCommentsGroupFromDoc(this.editor, this.commentsProvider);
70468
71310
  for (let i = 0; i < commentsGroup.length; i++) {
70469
71311
  const comment = commentsGroup[i];
70470
71312
  const groupItem = this.findGroupItem(comment.groupId);
@@ -70498,7 +71340,7 @@ ${codeText}
70498
71340
  return item;
70499
71341
  }
70500
71342
  findInsertPos(data2) {
70501
- const commentsMap = getCommentsGroupFromDoc(this.editor, this.commentsProvider);
71343
+ const commentsMap = getUnresolvedCommentsGroupFromDoc(this.editor, this.commentsProvider);
70502
71344
  const index2 = commentsMap.findIndex((group) => group.id === data2.id);
70503
71345
  if (index2 === -1) {
70504
71346
  return -1;
@@ -70634,6 +71476,8 @@ ${codeText}
70634
71476
  const comment = this.commentsProvider.getComment(commentId);
70635
71477
  this.list.handleUpdateComment(comment);
70636
71478
  }
71479
+ onUpdateCommentResolver(commentId, local) {
71480
+ }
70637
71481
  get commentOptions() {
70638
71482
  const commentOptions = this.editor.getComponentOptions("comment");
70639
71483
  return commentOptions;
@@ -70659,7 +71503,7 @@ ${codeText}
70659
71503
  }
70660
71504
  }
70661
71505
  function getMiniCommentsGroupFromDoc(editor, commentsProvider) {
70662
- const commentsGroupFromDoc = getCommentsGroupFromDoc(editor, commentsProvider);
71506
+ const commentsGroupFromDoc = getUnresolvedCommentsGroupFromDoc(editor, commentsProvider);
70663
71507
  const miniCommentGroups = /* @__PURE__ */ new Map();
70664
71508
  for (const commentGroup of commentsGroupFromDoc) {
70665
71509
  const blockId = getBlockIdByGroupId(editor, commentGroup.groupId);
@@ -70806,6 +71650,9 @@ ${codeText}
70806
71650
  }
70807
71651
  onUpdateComment(commentId, local) {
70808
71652
  }
71653
+ onUpdateCommentResolver(commentId, local) {
71654
+ this.list.updateMiniCommentsGroup();
71655
+ }
70809
71656
  show() {
70810
71657
  removeClass(this.root, "hidden");
70811
71658
  }
@@ -71034,12 +71881,18 @@ ${codeText}
71034
71881
  (_b = this.commentList) == null ? void 0 : _b.show(groupId);
71035
71882
  }
71036
71883
  });
71037
- __publicField(this, "showCommentList", (groupId) => {
71884
+ __publicField(this, "showCommentList", (groupId, type) => {
71885
+ var _a, _b;
71038
71886
  if (this.isMobile) {
71039
71887
  this.showComment("mobile", groupId);
71040
71888
  } else {
71041
71889
  this.showComment("web", groupId);
71042
71890
  }
71891
+ if (type) {
71892
+ (_a = this.getCommentList()) == null ? void 0 : _a.setListType(type);
71893
+ } else if (type === void 0) {
71894
+ (_b = this.getCommentList()) == null ? void 0 : _b.setListType("current");
71895
+ }
71043
71896
  });
71044
71897
  __publicField(this, "handleCommentListClose", () => {
71045
71898
  this.showComment("mini");
@@ -71074,6 +71927,15 @@ ${codeText}
71074
71927
  get isMobile() {
71075
71928
  return clientType.isMobile;
71076
71929
  }
71930
+ getCommentList() {
71931
+ return this.commentList;
71932
+ }
71933
+ getMobileCommentList() {
71934
+ return this.mobileCommentList;
71935
+ }
71936
+ getMiniCommentList() {
71937
+ return this.miniCommentList;
71938
+ }
71077
71939
  destroy() {
71078
71940
  var _a, _b;
71079
71941
  (_a = this.commentList) == null ? void 0 : _a.destroy();
@@ -71099,6 +71961,9 @@ ${codeText}
71099
71961
  if (containers.mobileContainer && this.mobileCommentList) {
71100
71962
  containers.mobileContainer.append(this.mobileCommentList.root);
71101
71963
  }
71964
+ if (containers.switchBarContainer && this.commentList) {
71965
+ this.commentList.setSwitcherParent(containers.switchBarContainer);
71966
+ }
71102
71967
  }
71103
71968
  }
71104
71969
  const style$7 = "";
@@ -71122,7 +71987,16 @@ ${codeText}
71122
71987
  more: "\u66F4\u591A",
71123
71988
  comment: "\u6DFB\u52A0\u6279\u6CE8",
71124
71989
  command: "\u6DFB\u52A0\u6279\u6CE8",
71125
- quickMenuCommand: "\u6DFB\u52A0\u6279\u6CE8"
71990
+ quickMenuCommand: "\u6DFB\u52A0\u6279\u6CE8",
71991
+ resolvedBy: '\u5DF2\u7531&nbsp;<span class="resolver-name">{name}</span>&nbsp;\u89E3\u51B3',
71992
+ reopen: "\u91CD\u65B0\u6253\u5F00",
71993
+ currentComment: "\u5F53\u524D\u6279\u6CE8",
71994
+ resolvedComment: "\u5DF2\u89E3\u51B3\u6279\u6CE8",
71995
+ removedFromDoc: "\u5F15\u7528\u5185\u5BB9\u5DF2\u5220\u9664",
71996
+ noCurrentComment: "\u6682\u65E0\u6279\u6CE8",
71997
+ noResolvedComment: "\u65E0\u5DF2\u89E3\u51B3\u6279\u6CE8",
71998
+ resolveComment: "\u6807\u8BB0\u4E3A\u5DF2\u89E3\u51B3",
71999
+ commentHasAlreadyRemoved: "\u5F15\u7528\u5185\u5BB9\u5DF2\u88AB\u5220\u9664\uFF0C\u4E0D\u53EF\u91CD\u65B0\u6253\u5F00\u6279\u6CE8"
71126
72000
  }
71127
72001
  };
71128
72002
  const zhHK$k = {
@@ -71168,7 +72042,16 @@ ${codeText}
71168
72042
  more: "More",
71169
72043
  comment: "Add annotation",
71170
72044
  command: "Add annotation",
71171
- quickMenuCommand: "Add annotation"
72045
+ quickMenuCommand: "Add annotation",
72046
+ resolvedBy: 'Resolved by&nbsp;<span class="resolver-name">{name}<span>',
72047
+ reopen: "Reopen",
72048
+ currentComment: "Unresolved annotations",
72049
+ resolvedComment: "Resolved annotations",
72050
+ removedFromDoc: "Quoted content deleted.",
72051
+ noCurrentComment: "No annotation.",
72052
+ noResolvedComment: "No resolved annotations.",
72053
+ resolveComment: "Mark as resolved",
72054
+ commentHasAlreadyRemoved: "Referenced content deleted. Comment can't be reopened."
71172
72055
  }
71173
72056
  };
71174
72057
  const jaJP$k = {
@@ -71191,7 +72074,16 @@ ${codeText}
71191
72074
  more: "\u305D\u306E\u4ED6",
71192
72075
  comment: "\u6CE8\u91C8\u3092\u8FFD\u52A0",
71193
72076
  command: "\u6CE8\u91C8\u3092\u8FFD\u52A0",
71194
- quickMenuCommand: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
72077
+ quickMenuCommand: "\u6CE8\u91C8\u3092\u8FFD\u52A0",
72078
+ resolvedBy: '<span class="resolver-name">{name}</span>\u3055\u3093\u304C\u89E3\u6C7A\u3057\u307E\u3057\u305F',
72079
+ reopen: "\u518D\u958B",
72080
+ currentComment: "\u672A\u89E3\u6C7A\u30B3\u30E1\u30F3\u30C8",
72081
+ resolvedComment: "\u89E3\u6C7A\u6E08\u307F\u30B3\u30E1\u30F3\u30C8",
72082
+ removedFromDoc: "\u5F15\u7528\u3055\u308C\u305F\u5185\u5BB9\u306F\u524A\u9664\u3055\u308C\u307E\u3057\u305F\u3002",
72083
+ noCurrentComment: "\u6CE8\u91C8\u306A\u3057",
72084
+ noResolvedComment: "\u89E3\u6C7A\u6E08\u307F\u30B3\u30E1\u30F3\u30C8\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
72085
+ resolveComment: "\u89E3\u6C7A\u3055\u308C\u307E\u3057\u305F",
72086
+ commentHasAlreadyRemoved: "\u5F15\u7528\u5143\u304C\u524A\u9664\u3055\u308C\u305F\u305F\u3081\u3001\u30B3\u30E1\u30F3\u30C8\u518D\u958B\u3067\u304D\u307E\u305B\u3093\u3002"
71195
72087
  }
71196
72088
  };
71197
72089
  i18n$1.mergeLang({
@@ -71200,61 +72092,6 @@ ${codeText}
71200
72092
  "en-US": enUS$k,
71201
72093
  "ja-JP": jaJP$k
71202
72094
  });
71203
- class OnesEditorCommentsRender {
71204
- renderText(editor, path, attributes) {
71205
- const classes = [];
71206
- const textAttributes = {};
71207
- Object.entries(attributes).forEach(([key, value]) => {
71208
- if (key.startsWith("comment-")) {
71209
- classes.push("comment");
71210
- textAttributes[key] = value;
71211
- }
71212
- });
71213
- return { classes, attributes: textAttributes };
71214
- }
71215
- renderBox(editor, path, attributes) {
71216
- const classes = [];
71217
- const textAttributes = {};
71218
- Object.entries(attributes).forEach(([key, value]) => {
71219
- if (key.startsWith("comment-")) {
71220
- classes.push("comment");
71221
- textAttributes[key] = value;
71222
- }
71223
- });
71224
- return { classes, attributes: textAttributes };
71225
- }
71226
- renderBlock(editor, path, blockData) {
71227
- const comments = blockData.comments;
71228
- if (!comments || comments.length === 0) {
71229
- return {};
71230
- }
71231
- const classes = ["comment"];
71232
- const attributes = {};
71233
- comments.forEach((commentId) => {
71234
- attributes[`comment-${commentId.toLocaleLowerCase()}`] = commentId;
71235
- });
71236
- return {
71237
- classes,
71238
- attributes
71239
- };
71240
- }
71241
- updateBlock(editor, path, blockElement, blockData) {
71242
- const comments = blockData.comments;
71243
- removeClass(blockElement, "comment");
71244
- Array.from(blockElement.attributes).forEach((a) => {
71245
- if (a.name.startsWith("comment-")) {
71246
- blockElement.removeAttribute(a.name);
71247
- }
71248
- });
71249
- if (!comments || comments.length === 0) {
71250
- return;
71251
- }
71252
- addClass(blockElement, "comment");
71253
- comments.forEach((commentId) => {
71254
- blockElement.setAttribute(`comment-${commentId.toLocaleLowerCase()}`, commentId);
71255
- });
71256
- }
71257
- }
71258
72095
  class OnesEditorCommentPlaceholderHandler {
71259
72096
  constructor(editor) {
71260
72097
  __publicField(this, "handleUpdateCompositionText", (editor, containerId, blockIndex, offset, end) => {
@@ -71406,6 +72243,21 @@ ${codeText}
71406
72243
  method: "delete"
71407
72244
  });
71408
72245
  }
72246
+ function updateCommentResolverToOldDoc(editor, version, commentId, resolver) {
72247
+ var _a, _b;
72248
+ const doc2 = editor.doc;
72249
+ const server = (_b = (_a = doc2.getServerMeta) == null ? void 0 : _a.call(doc2)) == null ? void 0 : _b.apiServer;
72250
+ assert(logger$16, server, "apiServer is not set");
72251
+ const api = `${server}/${version}/comments/${commentId}/resolver`;
72252
+ return doc2.request(api, {
72253
+ method: "put",
72254
+ data: {
72255
+ resolver
72256
+ }
72257
+ });
72258
+ }
72259
+ getLogger("resolved-comment-item");
72260
+ const styles = "";
71409
72261
  const isAllContainersSelected = (editor) => {
71410
72262
  var _a;
71411
72263
  const range = editor.selection.range;
@@ -71480,6 +72332,16 @@ ${codeText}
71480
72332
  await updateCommentToOldDoc(this.editor, this.version, commentId, comments.commentProvider.getCommentDoc(commentId));
71481
72333
  }
71482
72334
  }
72335
+ onUpdateCommentResolver(commentId, local) {
72336
+ const comments = this.editor.getCustom("editor-comments");
72337
+ const provider = comments.commentProvider;
72338
+ const comment = provider.getComment(commentId);
72339
+ if (!comment) {
72340
+ return;
72341
+ }
72342
+ const resolver = comment.resolver;
72343
+ updateCommentResolverToOldDoc(this.editor, this.version, commentId, resolver);
72344
+ }
71483
72345
  hideToolbar(editor) {
71484
72346
  const toolbar2 = editor.findCustom("toolbar-handler");
71485
72347
  toolbar2 == null ? void 0 : toolbar2.disableTextToolbar();
@@ -71506,6 +72368,7 @@ ${codeText}
71506
72368
  order: 60
71507
72369
  }],
71508
72370
  executeCommand: (editor2, block, item, child2) => {
72371
+ var _a2;
71509
72372
  if (!child2) {
71510
72373
  return;
71511
72374
  }
@@ -71516,6 +72379,7 @@ ${codeText}
71516
72379
  }
71517
72380
  this.hideToolbar(editor2);
71518
72381
  comments.showCommentList();
72382
+ (_a2 = comments.getCommentList()) == null ? void 0 : _a2.setListType("current");
71519
72383
  const offset = getChildOffset(block, child2);
71520
72384
  const range = createBlockSimpleRange(this.editor, block, offset.start, offset.end);
71521
72385
  const comment = addCommentToTextBlocks(editor2, range, comments.commentProvider);
@@ -71540,15 +72404,16 @@ ${codeText}
71540
72404
  order: 60
71541
72405
  }],
71542
72406
  executeCommand: (editor2, block, item) => {
72407
+ var _a2;
71543
72408
  if (item.id === "add-comment-to-old-doc") {
71544
72409
  const comments = editor2.getCustom("editor-comments");
71545
72410
  if (!comments) {
71546
72411
  return;
71547
72412
  }
71548
72413
  editor2.selection.selectBlock(block, 0, getBlockTextLength$6(editor2, block), { noScroll: true });
71549
- const editorComments = editor2.getCustom("editor-comments");
71550
- editorComments.showCommentList();
71551
- addCommentToBlock(editor2, block, editorComments.commentProvider);
72414
+ comments.showCommentList();
72415
+ (_a2 = comments.getCommentList()) == null ? void 0 : _a2.setListType("current");
72416
+ addCommentToBlock(editor2, block, comments.commentProvider);
71552
72417
  }
71553
72418
  }
71554
72419
  };
@@ -71573,12 +72438,14 @@ ${codeText}
71573
72438
  }];
71574
72439
  }
71575
72440
  executeCommand(editor, command, options) {
72441
+ var _a;
71576
72442
  if (command.id === "add-comment-to-old-doc/text") {
71577
72443
  const comments = editor.getCustom("editor-comments");
71578
72444
  if (!comments) {
71579
72445
  return;
71580
72446
  }
71581
72447
  comments.showCommentList();
72448
+ (_a = comments.getCommentList()) == null ? void 0 : _a.setListType("current");
71582
72449
  const range = editor.selection.range;
71583
72450
  if (!range.isSimple()) {
71584
72451
  if (isFullSelectedOneComplexBlock(editor, range)) {
@@ -76833,14 +77700,14 @@ ${docStr}
76833
77700
  }
76834
77701
  function isList(elem) {
76835
77702
  var _a;
76836
- const styles = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
76837
- return styles.findIndex((style2) => style2.startsWith("level")) !== -1;
77703
+ const styles2 = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
77704
+ return styles2.findIndex((style2) => style2.startsWith("level")) !== -1;
76838
77705
  }
76839
77706
  function getOfficeListGroupId(elem) {
76840
77707
  var _a;
76841
- const styles = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
76842
- for (let i = 0; i < styles.length; i++) {
76843
- const name = styles[i];
77708
+ const styles2 = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
77709
+ for (let i = 0; i < styles2.length; i++) {
77710
+ const name = styles2[i];
76844
77711
  if (name.startsWith("mso-list:")) {
76845
77712
  return name;
76846
77713
  }
@@ -76849,9 +77716,9 @@ ${docStr}
76849
77716
  }
76850
77717
  function getLevel(elem) {
76851
77718
  var _a, _b;
76852
- const styles = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
76853
- for (let i = 0; i < styles.length; i++) {
76854
- const name = styles[i];
77719
+ const styles2 = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
77720
+ for (let i = 0; i < styles2.length; i++) {
77721
+ const name = styles2[i];
76855
77722
  if (name.startsWith("level")) {
76856
77723
  const level = (_b = Number.parseInt(name.substring(5), 10)) != null ? _b : void 0;
76857
77724
  if (level) {
@@ -80542,6 +81409,8 @@ ${docStr}
80542
81409
  }
80543
81410
  onUpdateComment() {
80544
81411
  }
81412
+ onUpdateCommentResolver(commentId, local) {
81413
+ }
80545
81414
  }
80546
81415
  async function playHistoryData(doc2, versionHelper, historyData) {
80547
81416
  for (const data2 of historyData) {
@@ -85039,26 +85908,25 @@ ${docStr}
85039
85908
  var _a;
85040
85909
  const mermaidOptions = editor.getComponentOptions("mermaid") || {};
85041
85910
  const mermaidJsResource = ((_a = mermaidOptions.cdn) == null ? void 0 : _a.mermaid) || MERMAID_SCRIPTS;
85042
- await loadJsPromise(mermaidJsResource, MERMAID_SCRIPT_ID);
85911
+ try {
85912
+ await loadEmsJs(MERMAID_SCRIPT_ID, mermaidJsResource, "mermaid", "");
85913
+ } catch (err) {
85914
+ logger$k.error("Resource load failed: Mermaid javaScript resource injection failed", err instanceof Error ? err.message : String(err));
85915
+ }
85043
85916
  const mermaid = window.mermaid;
85044
85917
  assert(logger$k, mermaid, "Resource load failed: Mermaid javaScript resource injection failed");
85045
85918
  const id = genId();
85046
- const promise = new Promise((resolve, reject) => {
85047
- try {
85048
- mermaid.mermaidAPI.render(id, code, (svgCode2) => {
85049
- setTimeout(() => {
85050
- resolve(svgCode2);
85051
- });
85052
- });
85053
- } catch (err) {
85054
- err.message = err.str;
85055
- const delId = `d${id}`;
85056
- const el = document.getElementById(delId);
85057
- el == null ? void 0 : el.remove();
85058
- reject(err);
85059
- }
85060
- });
85061
- const svgCode = await promise;
85919
+ let svgCode = "";
85920
+ try {
85921
+ const { svg } = await mermaid.render(id, code);
85922
+ svgCode = svg;
85923
+ } catch (err) {
85924
+ err.message = err.str;
85925
+ const delId = `d${id}`;
85926
+ const el = document.getElementById(delId);
85927
+ el == null ? void 0 : el.remove();
85928
+ throw err;
85929
+ }
85062
85930
  const domParser = new DOMParser();
85063
85931
  const xml = domParser.parseFromString(svgCode, "image/svg+xml");
85064
85932
  const xmlSvg = xml.firstChild;
@@ -90871,6 +91739,9 @@ ${data2.plantumlText}
90871
91739
  localUpdateComment(comment, doc2) {
90872
91740
  this.doc.localUpdateComment(comment, doc2);
90873
91741
  }
91742
+ localUpdateCommentResolver(commentId, resolver) {
91743
+ this.doc.localUpdateCommentResolver(commentId, resolver);
91744
+ }
90874
91745
  onCreateComment(commentId, local) {
90875
91746
  Array.from(this.listeners.values()).forEach((listener) => listener.onCreateComment(commentId, local));
90876
91747
  }
@@ -90880,6 +91751,9 @@ ${data2.plantumlText}
90880
91751
  onUpdateComment(commentId, local) {
90881
91752
  Array.from(this.listeners.values()).forEach((listener) => listener.onUpdateComment(commentId, local));
90882
91753
  }
91754
+ onUpdateCommentResolver(commentId, local) {
91755
+ Array.from(this.listeners.values()).forEach((listener) => listener.onUpdateCommentResolver(commentId, local));
91756
+ }
90883
91757
  addListener(callback) {
90884
91758
  this.listeners.add(callback);
90885
91759
  }
@@ -90905,9 +91779,10 @@ ${data2.plantumlText}
90905
91779
  constructor(editor, localDoc) {
90906
91780
  __publicField(this, "_listeners", /* @__PURE__ */ new Set());
90907
91781
  __publicField(this, "_doc");
91782
+ var _a, _b;
90908
91783
  this.editor = editor;
90909
91784
  this.localDoc = localDoc;
90910
- this._doc = this.localDoc.toJSON();
91785
+ this._doc = ((_b = (_a = this.localDoc).rawData) == null ? void 0 : _b.call(_a)) || this.localDoc.toJSON();
90911
91786
  }
90912
91787
  get doc() {
90913
91788
  return this._doc;
@@ -90962,6 +91837,17 @@ ${data2.plantumlText}
90962
91837
  this._doc.comments[id] = shareDBComment;
90963
91838
  Array.from(this._listeners.values()).forEach((listener) => listener.onUpdateComment(id, true));
90964
91839
  }
91840
+ localUpdateCommentResolver(commentId, resolver) {
91841
+ const comment = this.getComment(commentId);
91842
+ if (comment) {
91843
+ if (resolver) {
91844
+ comment.resolver = resolver;
91845
+ } else {
91846
+ delete comment.resolver;
91847
+ }
91848
+ Array.from(this._listeners.values()).forEach((listener) => listener.onUpdateCommentResolver(commentId, true));
91849
+ }
91850
+ }
90965
91851
  createCommentEditor(parent, childDoc) {
90966
91852
  const commentEditor = createCommentEditor(this.editor, {
90967
91853
  root: parent,
@@ -91732,8 +92618,8 @@ ${JSON.stringify(error2, null, 2)}`);
91732
92618
  const inlineStyles = attributesOfText(text2, "inlineStyle");
91733
92619
  if (inlineStyles == null)
91734
92620
  return;
91735
- const styles = inlineStyles.split(";");
91736
- for (const style2 of styles) {
92621
+ const styles2 = inlineStyles.split(";");
92622
+ for (const style2 of styles2) {
91737
92623
  const pair = style2.split(":");
91738
92624
  if (pair.length !== 2)
91739
92625
  continue;
@@ -93564,6 +94450,7 @@ ${JSON.stringify(error2, null, 2)}`);
93564
94450
  id: options.id,
93565
94451
  scrollContainer: options == null ? void 0 : options.scrollContainer,
93566
94452
  enableComments: options == null ? void 0 : options.enableComments,
94453
+ enableResolveComments: options == null ? void 0 : options.enableResolveComments,
93567
94454
  enableContextMenu: options == null ? void 0 : options.enableContextMenu,
93568
94455
  components: {
93569
94456
  blocks: [...StandardBlocks, ...((_d = options == null ? void 0 : options.components) == null ? void 0 : _d.blocks) || []],
@@ -93801,7 +94688,7 @@ ${JSON.stringify(error2, null, 2)}`);
93801
94688
  }
93802
94689
  }
93803
94690
  });
93804
- editor.version = "2.8.35";
94691
+ editor.version = "2.9.1-beta.3";
93805
94692
  return editor;
93806
94693
  }
93807
94694
  function isDoc(doc2) {
@@ -93823,6 +94710,7 @@ ${JSON.stringify(error2, null, 2)}`);
93823
94710
  const editor = createEditor(root2, doc2, {
93824
94711
  id: options.id,
93825
94712
  scrollContainer: options == null ? void 0 : options.scrollContainer,
94713
+ enableResolveComments: options == null ? void 0 : options.enableResolveComments,
93826
94714
  components: {
93827
94715
  blocks: [...StandardBlocks, ...(_f = (_e = options.components) == null ? void 0 : _e.blocks) != null ? _f : []],
93828
94716
  commandProviders: [new TableBlockCommandProvider()],
@@ -93914,7 +94802,7 @@ ${JSON.stringify(error2, null, 2)}`);
93914
94802
  }
93915
94803
  });
93916
94804
  OnesEditorToolbar.register(editor);
93917
- editor.version = "2.8.35";
94805
+ editor.version = "2.9.1-beta.3";
93918
94806
  return editor;
93919
94807
  }
93920
94808
  async function showDocVersions(editor, options, serverUrl) {
@@ -139734,6 +140622,7 @@ ${JSON.stringify(error2, null, 2)}`);
139734
140622
  exports2.CheckMarkIcon = CheckMarkIcon;
139735
140623
  exports2.CheckboxIcon = CheckboxIcon;
139736
140624
  exports2.CircleAddIcon = CircleAddIcon;
140625
+ exports2.CircleCheckMarkIcon = CircleCheckMarkIcon;
139737
140626
  exports2.ClearIcon = ClearIcon;
139738
140627
  exports2.ClipboardProvider = ClipboardProvider;
139739
140628
  exports2.CloseIcon = CloseIcon;
@@ -139884,6 +140773,8 @@ ${JSON.stringify(error2, null, 2)}`);
139884
140773
  exports2.MoreItem = MoreItem;
139885
140774
  exports2.NextIcon = NextIcon;
139886
140775
  exports2.OnesEditorAutoSuggest = OnesEditorAutoSuggest;
140776
+ exports2.OnesEditorComments = OnesEditorComments;
140777
+ exports2.OnesEditorCommentsRender = OnesEditorCommentsRender;
139887
140778
  exports2.OnesEditorCustomDataWrapper = OnesEditorCustomDataWrapper;
139888
140779
  exports2.OnesEditorExclusiveBlock = OnesEditorExclusiveBlock;
139889
140780
  exports2.OnesEditorHoveringBlock = OnesEditorHoveringBlock;
@@ -140423,6 +141314,7 @@ ${JSON.stringify(error2, null, 2)}`);
140423
141314
  exports2.isValidOffset = isValidOffset;
140424
141315
  exports2.isVisibleBlock = isVisibleBlock;
140425
141316
  exports2.isYesterday = isYesterday;
141317
+ exports2.loadEmsJs = loadEmsJs;
140426
141318
  exports2.loadJs = loadJs;
140427
141319
  exports2.loadJsPromise = loadJsPromise;
140428
141320
  exports2.lockers = lockers;