@ones-editor/editor 2.8.27 → 2.8.28-beta.2

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 (43) hide show
  1. package/@ones-editor/comments/src/comment-item/comment-item.d.ts +1 -0
  2. package/@ones-editor/comments/src/comments/comments.d.ts +5 -1
  3. package/@ones-editor/comments/src/comments-helper/active-comment.d.ts +3 -1
  4. package/@ones-editor/comments/src/comments-helper/get-comment-from-selection.d.ts +3 -0
  5. package/@ones-editor/comments/src/comments-helper/get-comments-from-doc.d.ts +5 -1
  6. package/@ones-editor/comments/src/comments-helper/old-version-comment.d.ts +2 -1
  7. package/@ones-editor/comments/src/comments-list/comments-list.d.ts +13 -2
  8. package/@ones-editor/comments/src/comments-list/group-item.d.ts +2 -0
  9. package/@ones-editor/comments/src/comments-list/group-list.d.ts +7 -2
  10. package/@ones-editor/comments/src/comments-list/handler.d.ts +2 -1
  11. package/@ones-editor/comments/src/comments-list/mini-comment/group-list.d.ts +1 -1
  12. package/@ones-editor/comments/src/comments-list/mini-comment/mini-comments-list.d.ts +1 -0
  13. package/@ones-editor/comments/src/comments-list/mobile-comments-list/mobile-comments-list.d.ts +1 -0
  14. package/@ones-editor/comments/src/comments-render/get-block-comments.d.ts +5 -0
  15. package/@ones-editor/comments/src/comments-render/index.d.ts +10 -1
  16. package/@ones-editor/comments/src/constant/index.d.ts +2 -1
  17. package/@ones-editor/comments/src/index.d.ts +1 -0
  18. package/@ones-editor/comments/src/locale/en-us.d.ts +8 -0
  19. package/@ones-editor/comments/src/locale/ja-jp.d.ts +8 -0
  20. package/@ones-editor/comments/src/locale/zh-cn.d.ts +8 -0
  21. package/@ones-editor/comments/src/resolved-comments/index.d.ts +4 -0
  22. package/@ones-editor/comments/src/resolved-comments/resolved-comment-editor.d.ts +14 -0
  23. package/@ones-editor/comments/src/resolved-comments/resolved-comment-list.d.ts +4 -0
  24. package/@ones-editor/comments/src/types.d.ts +6 -1
  25. package/@ones-editor/core/src/core/block-renderers/block-renderers.d.ts +1 -0
  26. package/@ones-editor/core/src/core/composition/editor-input.d.ts +2 -0
  27. package/@ones-editor/core/src/core/doc/doc.d.ts +9 -0
  28. package/@ones-editor/core/src/core/types.d.ts +3 -0
  29. package/@ones-editor/core/src/local-doc/index.d.ts +1 -0
  30. package/@ones-editor/sharedb-doc/src/doc/comments.d.ts +2 -1
  31. package/@ones-editor/sharedb-doc/src/doc/op-parser/parse-handler.d.ts +2 -1
  32. package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +3 -1
  33. package/@ones-editor/sharedb-doc/src/types.d.ts +1 -0
  34. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  35. package/@ones-editor/ui/src/readonly-toolbar/add-comment-to-old-doc.d.ts +1 -0
  36. package/@ones-editor/ui-base/src/icons/index.d.ts +2 -1
  37. package/@ones-editor/versions/src/version-dialog/history-handler.d.ts +1 -0
  38. package/dist/comments/local-doc-comments-provider.d.ts +2 -1
  39. package/dist/comments/sharedb-doc-comments-provider.d.ts +3 -1
  40. package/dist/index.d.ts +2 -0
  41. package/dist/index.js +936 -151
  42. package/dist/types.d.ts +2 -0
  43. package/package.json +1 -1
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[list-type=resolved] .comment-groups-container {
4330
+ display: flex;
4331
+ flex-direction: column;
4332
+ gap: 20px;
4333
+ padding-left: 8px;
4334
+ padding-top: 60px;
4335
+ }
4336
+ .editor-web-comment-root[list-type=resolved] .comment-groups-container .comment-no-resolved-tip {
4337
+ font-size: 12px;
4338
+ width: 100%;
4339
+ color: #BEBFC2;
4340
+ display: flex;
4341
+ justify-content: center;
4342
+ align-items: center;
4343
+ margin-top: 100px;
4344
+ }
4345
+ .editor-web-comment-root[list-type=resolved] .comment-groups-container .comment-group-item-root {
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,57 @@ 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-actions {
4455
+ display: flex;
4456
+ align-items: center;
4457
+ }
4458
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions .comment-date {
4459
+ flex: 1;
4460
+ white-space: nowrap;
4461
+ }
4462
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions .removed-tips {
4463
+ color: #87888A;
4464
+ white-space: nowrap;
4465
+ text-overflow: ellipsis;
4466
+ overflow: hidden;
4467
+ margin-left: 10px;
4468
+ }
4469
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions .comment-reopen {
4470
+ background: none;
4471
+ border: none;
4472
+ cursor: pointer;
4473
+ color: #575859;
4474
+ font-size: 12px;
4475
+ }
4476
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions .comment-reopen:hover {
4477
+ color: #0064FF;
4478
+ }
4401
4479
  .editor-web-comment-root .comment-groups-container .comment-group-item-root.active::before {
4402
4480
  background-color: #f59300;
4403
4481
  }
4404
- .editor-web-comment-root .comment-groups-container .comment-group-item-root.active .item-head-switch {
4482
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root.active .item-head-switch .editor-text-button[data-button-id=switch-up] {
4483
+ visibility: visible;
4484
+ }
4485
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root.active .item-head-switch .editor-text-button[data-button-id=switch-down] {
4405
4486
  visibility: visible;
4406
4487
  }
4407
4488
  .editor-web-comment-root .comment-groups-container .comment-group-item-root.readonly .comment-quick-reply .quick-reply-button.invisible {
4408
4489
  display: none;
4409
4490
  }
4491
+ .editor-web-comment-root .comment-switcher-container {
4492
+ position: absolute;
4493
+ z-index: 1;
4494
+ top: 0;
4495
+ left: 0;
4496
+ right: 0;
4497
+ font-size: 14px;
4498
+ }
4410
4499
  .editor-mobile-comments-root {
4411
4500
  position: fixed;
4412
4501
  left: 0;
@@ -4508,6 +4597,99 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4508
4597
  }
4509
4598
  :is(.editor-web-comment-root, .editor-mobile-comments-root, .editor-mini-comment-root).hidden {
4510
4599
  display: none;
4600
+ }
4601
+ .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 {
4602
+ border-bottom-color: transparent;
4603
+ }
4604
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block] span.text.comment,
4605
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block] span[data-type=editor-box].comment {
4606
+ border-bottom-color: transparent;
4607
+ }
4608
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block] span.text.comment.active,
4609
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block] span[data-type=editor-box].comment.active {
4610
+ background-color: transparent;
4611
+ }
4612
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block].comment::after {
4613
+ background-color: transparent;
4614
+ }
4615
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block].comment.active {
4616
+ outline: none;
4617
+ }.resolved-comment-list .resolved-comment-group-item-root {
4618
+ padding: 10px 20px;
4619
+ border-bottom: 1px solid #f0f0f0;
4620
+ margin-right: 10px;
4621
+ }
4622
+ .resolved-comment-list .resolved-comment-group-item-root .comment-group-head {
4623
+ margin-bottom: 5px;
4624
+ }
4625
+ .resolved-comment-list .resolved-comment-group-item-root .comment-group-head span {
4626
+ padding: 0 5px;
4627
+ display: inline-block;
4628
+ line-height: 2;
4629
+ background-color: #FFF0D9;
4630
+ }
4631
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container,
4632
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container {
4633
+ padding-left: 10px;
4634
+ }
4635
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root,
4636
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root {
4637
+ position: relative;
4638
+ }
4639
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root:not(.no-children)::before,
4640
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root:not(.no-children)::before {
4641
+ content: " ";
4642
+ display: block;
4643
+ position: absolute;
4644
+ left: 10px;
4645
+ width: 1px;
4646
+ background-color: #DFE1E5;
4647
+ overflow: hidden;
4648
+ opacity: 0.8;
4649
+ top: 21px;
4650
+ bottom: -12px;
4651
+ transform: scaleX(0.5);
4652
+ }
4653
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root .comment-head,
4654
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root .comment-head {
4655
+ padding: 0;
4656
+ position: relative;
4657
+ display: flex;
4658
+ align-items: center;
4659
+ }
4660
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root .comment-head .comment-avatar,
4661
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root .comment-head .comment-avatar {
4662
+ margin-right: 5px;
4663
+ width: var(--editor-comment-avatar-width, 22px);
4664
+ height: var(--editor-comment-avatar-width, 22px);
4665
+ border-radius: 100%;
4666
+ }
4667
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root .comment-head .comment-username,
4668
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root .comment-head .comment-username {
4669
+ font-size: var(--editor-comment-username-font-size, 12px);
4670
+ color: #2d2d2e;
4671
+ overflow: hidden;
4672
+ text-overflow: ellipsis;
4673
+ white-space: nowrap;
4674
+ }
4675
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root .comment-head .comment-modified,
4676
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root .comment-head .comment-modified {
4677
+ margin-left: 10px;
4678
+ font-size: 12px;
4679
+ color: #87888a;
4680
+ flex-grow: 1;
4681
+ white-space: nowrap;
4682
+ }
4683
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root .comment-editor,
4684
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root .comment-editor {
4685
+ border: none;
4686
+ padding-top: 0;
4687
+ margin-top: 0;
4688
+ padding-left: 10px;
4689
+ margin-left: 0;
4690
+ }
4691
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root:last-child::before {
4692
+ display: none;
4511
4693
  }div[data-type=editor-block].table-block {
4512
4694
  --table-bar-width: 6px;
4513
4695
  --table-bar-left: -6px;
@@ -9207,22 +9389,22 @@ var __publicField = (obj, key, value) => {
9207
9389
  function toFloat(value) {
9208
9390
  return parseFloat(value) || 0;
9209
9391
  }
9210
- function getBordersSize(styles) {
9392
+ function getBordersSize(styles2) {
9211
9393
  var positions = [];
9212
9394
  for (var _i = 1; _i < arguments.length; _i++) {
9213
9395
  positions[_i - 1] = arguments[_i];
9214
9396
  }
9215
9397
  return positions.reduce(function(size, position) {
9216
- var value = styles["border-" + position + "-width"];
9398
+ var value = styles2["border-" + position + "-width"];
9217
9399
  return size + toFloat(value);
9218
9400
  }, 0);
9219
9401
  }
9220
- function getPaddings(styles) {
9402
+ function getPaddings(styles2) {
9221
9403
  var positions = ["top", "right", "bottom", "left"];
9222
9404
  var paddings = {};
9223
9405
  for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
9224
9406
  var position = positions_1[_i];
9225
- var value = styles["padding-" + position];
9407
+ var value = styles2["padding-" + position];
9226
9408
  paddings[position] = toFloat(value);
9227
9409
  }
9228
9410
  return paddings;
@@ -9236,17 +9418,17 @@ var __publicField = (obj, key, value) => {
9236
9418
  if (!clientWidth && !clientHeight) {
9237
9419
  return emptyRect;
9238
9420
  }
9239
- var styles = getWindowOf(target).getComputedStyle(target);
9240
- var paddings = getPaddings(styles);
9421
+ var styles2 = getWindowOf(target).getComputedStyle(target);
9422
+ var paddings = getPaddings(styles2);
9241
9423
  var horizPad = paddings.left + paddings.right;
9242
9424
  var vertPad = paddings.top + paddings.bottom;
9243
- var width = toFloat(styles.width), height = toFloat(styles.height);
9244
- if (styles.boxSizing === "border-box") {
9425
+ var width = toFloat(styles2.width), height = toFloat(styles2.height);
9426
+ if (styles2.boxSizing === "border-box") {
9245
9427
  if (Math.round(width + horizPad) !== clientWidth) {
9246
- width -= getBordersSize(styles, "left", "right") + horizPad;
9428
+ width -= getBordersSize(styles2, "left", "right") + horizPad;
9247
9429
  }
9248
9430
  if (Math.round(height + vertPad) !== clientHeight) {
9249
- height -= getBordersSize(styles, "top", "bottom") + vertPad;
9431
+ height -= getBordersSize(styles2, "top", "bottom") + vertPad;
9250
9432
  }
9251
9433
  }
9252
9434
  if (!isDocumentElement(target)) {
@@ -9901,8 +10083,8 @@ var __publicField = (obj, key, value) => {
9901
10083
  el.setAttribute(key, value);
9902
10084
  });
9903
10085
  }
9904
- function setStyles(el, styles) {
9905
- Object.entries(styles).forEach(([key, value]) => {
10086
+ function setStyles(el, styles2) {
10087
+ Object.entries(styles2).forEach(([key, value]) => {
9906
10088
  el.style.setProperty(key, value);
9907
10089
  });
9908
10090
  }
@@ -12322,12 +12504,12 @@ var __publicField = (obj, key, value) => {
12322
12504
  return blockClass.getBlockStyles(editor, block);
12323
12505
  }
12324
12506
  const data2 = editor.getBlockData(block);
12325
- const styles = Object.fromEntries(Object.entries(data2).filter(([key]) => key.startsWith("style-")));
12326
- Object.entries(styles).forEach(([, value]) => {
12507
+ const styles2 = Object.fromEntries(Object.entries(data2).filter(([key]) => key.startsWith("style-")));
12508
+ Object.entries(styles2).forEach(([, value]) => {
12327
12509
  const type = typeof value;
12328
12510
  assert(logger$4C, type === "string" || type === "number" || type === "boolean", "invalid style value");
12329
12511
  });
12330
- return styles;
12512
+ return styles2;
12331
12513
  }
12332
12514
  function getContainerWidth(container, options) {
12333
12515
  const ret = container.getBoundingClientRect().width;
@@ -24916,7 +25098,7 @@ var __publicField = (obj, key, value) => {
24916
25098
  if (attributes) {
24917
25099
  let string = op.insert;
24918
25100
  const tags = [];
24919
- let styles = "";
25101
+ let styles2 = "";
24920
25102
  if (attributes["style-bold"]) {
24921
25103
  tags.push("strong");
24922
25104
  }
@@ -24934,25 +25116,25 @@ var __publicField = (obj, key, value) => {
24934
25116
  }
24935
25117
  const fontBgColor = Object.keys(attributes).find((k) => k.startsWith("style-bg-color-"));
24936
25118
  if (fontBgColor) {
24937
- styles += `background-color: ${styleBackgroundColorToHighlight$1(fontBgColor)};`;
25119
+ styles2 += `background-color: ${styleBackgroundColorToHighlight$1(fontBgColor)};`;
24938
25120
  }
24939
25121
  const fontColor = Object.keys(attributes).find((k) => k.startsWith("style-color-"));
24940
25122
  if (fontColor) {
24941
- styles += `color: ${styleColorToColor$1(fontColor)};`;
25123
+ styles2 += `color: ${styleColorToColor$1(fontColor)};`;
24942
25124
  }
24943
25125
  if (attributes.link) {
24944
25126
  string = `<a href="${attributes.link}">${string}</a>`;
24945
25127
  }
24946
25128
  let prefix = tags.map((s) => `<${s}>`).join("");
24947
25129
  let suffix = tags.reverse().map((s) => `</${s}>`).join("");
24948
- if (styles) {
25130
+ if (styles2) {
24949
25131
  if (attributes.link) {
24950
- string = `<a href="${attributes.link}" style="${styles}">${op.insert}</a>`;
25132
+ string = `<a href="${attributes.link}" style="${styles2}">${op.insert}</a>`;
24951
25133
  } else {
24952
25134
  if (prefix) {
24953
- prefix = prefix.replace(">", ` style="${styles}">`);
25135
+ prefix = prefix.replace(">", ` style="${styles2}">`);
24954
25136
  } else {
24955
- prefix = `<span style="${styles}">`;
25137
+ prefix = `<span style="${styles2}">`;
24956
25138
  suffix = "</span>";
24957
25139
  }
24958
25140
  }
@@ -25395,6 +25577,9 @@ var __publicField = (obj, key, value) => {
25395
25577
  __publicField(this, "renders", []);
25396
25578
  this.editor = editor;
25397
25579
  }
25580
+ getRenderers() {
25581
+ return this.renders;
25582
+ }
25398
25583
  registerRender(render) {
25399
25584
  this.renders.push(render);
25400
25585
  }
@@ -25632,8 +25817,8 @@ var __publicField = (obj, key, value) => {
25632
25817
  renderBlock(editor, path, blockData) {
25633
25818
  var _a, _b;
25634
25819
  const attributes = {};
25635
- const styles = Object.entries(blockData).filter((k) => k[0].startsWith("style-"));
25636
- styles.forEach(([key, value]) => {
25820
+ const styles2 = Object.entries(blockData).filter((k) => k[0].startsWith("style-"));
25821
+ styles2.forEach(([key, value]) => {
25637
25822
  attributes[`data-${key}`] = `${value}`;
25638
25823
  });
25639
25824
  const classes = [];
@@ -25840,6 +26025,7 @@ var __publicField = (obj, key, value) => {
25840
26025
  constructor(editor, callbacks) {
25841
26026
  __publicField(this, "editor");
25842
26027
  __publicField(this, "composing", false);
26028
+ __publicField(this, "composingTimer");
25843
26029
  __publicField(this, "callbacks");
25844
26030
  __publicField(this, "inputElement");
25845
26031
  __publicField(this, "handleBlur", () => {
@@ -25899,12 +26085,13 @@ var __publicField = (obj, key, value) => {
25899
26085
  if (!this.editor.isWritable()) {
25900
26086
  return;
25901
26087
  }
26088
+ clearTimeout(this.composingTimer);
25902
26089
  this.composing = true;
25903
26090
  this.callbacks.onCompositionStart(event);
25904
26091
  });
25905
26092
  __publicField(this, "handleCompositionend", (event) => {
25906
26093
  if (isSafari()) {
25907
- setTimeout(() => {
26094
+ this.composingTimer = setTimeout(() => {
25908
26095
  this.composing = false;
25909
26096
  }, 100);
25910
26097
  } else {
@@ -31604,7 +31791,7 @@ ${codeText}
31604
31791
  const logger$38 = getLogger("editor");
31605
31792
  class Editor extends tinyTypedEmitter.TypedEmitter {
31606
31793
  constructor(parent, doc2, optionalOptions) {
31607
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
31794
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
31608
31795
  super();
31609
31796
  __publicField(this, "parent");
31610
31797
  __publicField(this, "rootElement");
@@ -31650,12 +31837,13 @@ ${codeText}
31650
31837
  componentsOptions: (_c = (_b = optionalOptions == null ? void 0 : optionalOptions.components) == null ? void 0 : _b.options) != null ? _c : {},
31651
31838
  scrollContainer: optionalOptions == null ? void 0 : optionalOptions.scrollContainer,
31652
31839
  enableComments: (_d = optionalOptions == null ? void 0 : optionalOptions.enableComments) != null ? _d : true,
31653
- enableContextMenu: (_e = optionalOptions == null ? void 0 : optionalOptions.enableContextMenu) != null ? _e : true
31840
+ enableResolveComments: (_e = optionalOptions == null ? void 0 : optionalOptions.enableResolveComments) != null ? _e : true,
31841
+ enableContextMenu: (_f = optionalOptions == null ? void 0 : optionalOptions.enableContextMenu) != null ? _f : true
31654
31842
  };
31655
- this.settingsProvider = (_f = optionalOptions == null ? void 0 : optionalOptions.settingsProvider) != null ? _f : new DefaultSettingsProvider(this);
31843
+ this.settingsProvider = (_g = optionalOptions == null ? void 0 : optionalOptions.settingsProvider) != null ? _g : new DefaultSettingsProvider(this);
31656
31844
  registerComponents(this, optionalOptions == null ? void 0 : optionalOptions.components);
31657
- this.blockHooks.push(...(_h = (_g = optionalOptions == null ? void 0 : optionalOptions.components) == null ? void 0 : _g.blockHooks) != null ? _h : []);
31658
- this.id = (_i = optionalOptions == null ? void 0 : optionalOptions.id) != null ? _i : genId();
31845
+ this.blockHooks.push(...(_i = (_h = optionalOptions == null ? void 0 : optionalOptions.components) == null ? void 0 : _h.blockHooks) != null ? _i : []);
31846
+ this.id = (_j = optionalOptions == null ? void 0 : optionalOptions.id) != null ? _j : genId();
31659
31847
  this.clientId = genId();
31660
31848
  this.undoManager = new UndoManager(this);
31661
31849
  this.doc = new EditorDoc(this, doc2, this.undoManager);
@@ -32141,6 +32329,9 @@ ${codeText}
32141
32329
  toJSON() {
32142
32330
  return cloneDeep__default.default(this.doc);
32143
32331
  }
32332
+ rawData() {
32333
+ return this.doc;
32334
+ }
32144
32335
  getContainerBlocks(containerId) {
32145
32336
  const blocks = this.doc.blocks[containerId];
32146
32337
  return blocks;
@@ -38661,6 +38852,12 @@ ${codeText}
38661
38852
  commentId
38662
38853
  });
38663
38854
  }
38855
+ onUpdateCommentResolver(commentId) {
38856
+ this.pushActions({
38857
+ type: "updateCommentResolved",
38858
+ commentId
38859
+ });
38860
+ }
38664
38861
  end() {
38665
38862
  const actions2 = this.actions;
38666
38863
  const deletedBlocks = /* @__PURE__ */ new Set();
@@ -38735,6 +38932,9 @@ ${codeText}
38735
38932
  } else if (action.type === "updateComment") {
38736
38933
  const a = action;
38737
38934
  this.outerHandler.onUpdateComment(a.commentId, this.local);
38935
+ } else if (action.type === "updateCommentResolved") {
38936
+ const a = action;
38937
+ this.outerHandler.onUpdateCommentResolver(a.commentId, this.local);
38738
38938
  }
38739
38939
  });
38740
38940
  Array.from(updatingBlockDataDeltaMap.entries()).forEach(([blockId, objectData]) => {
@@ -38912,7 +39112,14 @@ ${codeText}
38912
39112
  assert(logger$2W, commentId, `invalid comment op, no commentId: ${JSON.stringify(ops)}`);
38913
39113
  assert(logger$2W, actions2, `invalid comment op, no actions: ${JSON.stringify(ops)}`);
38914
39114
  if (typeof actions2 === "string") {
38915
- logger$2W.error(`unknown comment op, ${JSON.stringify(ops)}`);
39115
+ const data2 = ops[3];
39116
+ if (actions2 === "resolver" && typeof data2 === "object") {
39117
+ if (parseType === "upsert") {
39118
+ handler.onUpdateCommentResolver(commentId);
39119
+ }
39120
+ } else {
39121
+ logger$2W.error(`unknown comment op, ${JSON.stringify(ops)}`);
39122
+ }
38916
39123
  } else {
38917
39124
  if (actions2.i && actions2.r) {
38918
39125
  if (parseType === "upsert") {
@@ -39022,7 +39229,8 @@ ${codeText}
39022
39229
  avatarUrl,
39023
39230
  abstract,
39024
39231
  created,
39025
- modified
39232
+ modified,
39233
+ resolver: resolved
39026
39234
  } = shareDBComment;
39027
39235
  return {
39028
39236
  id,
@@ -39032,7 +39240,8 @@ ${codeText}
39032
39240
  avatarUrl,
39033
39241
  abstract,
39034
39242
  created,
39035
- modified
39243
+ modified,
39244
+ resolver: resolved
39036
39245
  };
39037
39246
  }
39038
39247
  function commentToShareDbComment(comment, doc2) {
@@ -39504,6 +39713,21 @@ ${codeText}
39504
39713
  const op = ["comments", comment.id, { r: true, i: shareDBComment }];
39505
39714
  return this.submitOp(op);
39506
39715
  }
39716
+ localUpdateCommentResolver(commentId, resolver) {
39717
+ const oldComment = this.getComment(commentId);
39718
+ const oldResolved = oldComment.resolver;
39719
+ const op = ["comments", commentId, "resolver", {}];
39720
+ if (!oldResolved && !resolver) {
39721
+ return Promise.resolve(true);
39722
+ }
39723
+ if (oldResolved !== void 0) {
39724
+ op[3] = { r: true };
39725
+ }
39726
+ if (resolver) {
39727
+ op[3].i = resolver;
39728
+ }
39729
+ return this.submitOp(op);
39730
+ }
39507
39731
  destroy() {
39508
39732
  var _a;
39509
39733
  this.destroyed = true;
@@ -39580,6 +39804,13 @@ ${codeText}
39580
39804
  return (_a = cb.onUpdateComment) == null ? void 0 : _a.call(cb, commentId, local);
39581
39805
  });
39582
39806
  }
39807
+ onUpdateCommentResolver(commentId, local) {
39808
+ assert(logger$2T, this.callbacks.length > 0, "no callbacks");
39809
+ this.callbacks.forEach((cb) => {
39810
+ var _a;
39811
+ return (_a = cb.onUpdateCommentResolver) == null ? void 0 : _a.call(cb, commentId, local);
39812
+ });
39813
+ }
39583
39814
  onCustomMessage(msg) {
39584
39815
  const message = msg;
39585
39816
  if ((message == null ? void 0 : message.type) === "custom" && (message == null ? void 0 : message.clientId) !== this.client.clientId) {
@@ -40609,6 +40840,7 @@ ${codeText}
40609
40840
  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>';
40610
40841
  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';
40611
40842
  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>';
40843
+ 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';
40612
40844
  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';
40613
40845
  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';
40614
40846
  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';
@@ -40764,6 +40996,7 @@ ${codeText}
40764
40996
  RefreshIcon,
40765
40997
  HelpIcon,
40766
40998
  CheckMarkIcon,
40999
+ CircleCheckMarkIcon,
40767
41000
  TextIcon,
40768
41001
  RightArrowIcon: rightArrow,
40769
41002
  TencentVideoIcon,
@@ -50551,7 +50784,7 @@ ${codeText}
50551
50784
  });
50552
50785
  return !!ret;
50553
50786
  }
50554
- function addBlockClasses(from, to, styles) {
50787
+ function addBlockClasses(from, to, styles2) {
50555
50788
  const container = getParentContainer(from);
50556
50789
  if (to) {
50557
50790
  const container2 = getParentContainer(to);
@@ -50562,18 +50795,18 @@ ${codeText}
50562
50795
  const toIndex = getBlockIndex(to);
50563
50796
  assert(logger$24, fromIndex <= toIndex, "invalid block index");
50564
50797
  }
50565
- addClass(from, ...styles);
50798
+ addClass(from, ...styles2);
50566
50799
  if (!to || to === from) {
50567
50800
  return;
50568
50801
  }
50569
50802
  let next2 = getNextBlock(from);
50570
50803
  while (next2 !== to) {
50571
50804
  assert(logger$24, next2, "no next button");
50572
- addClass(next2, ...styles);
50805
+ addClass(next2, ...styles2);
50573
50806
  next2 = getNextBlock(next2);
50574
50807
  }
50575
50808
  if (next2) {
50576
- addClass(next2, ...styles);
50809
+ addClass(next2, ...styles2);
50577
50810
  }
50578
50811
  }
50579
50812
  async function requestMindmapFullscreen(editor, block, mindmapTools) {
@@ -51561,7 +51794,7 @@ ${codeText}
51561
51794
  html = `<input type="checkbox" disabled="disabled" /> ${html}`;
51562
51795
  }
51563
51796
  let listTag = "ul";
51564
- let styles = "";
51797
+ let styles2 = "";
51565
51798
  if (list2.ordered) {
51566
51799
  html = `<li value="${list2.start}">${html}</li>`;
51567
51800
  listTag = "ol";
@@ -51569,18 +51802,18 @@ ${codeText}
51569
51802
  case 2:
51570
51803
  case 5:
51571
51804
  case 8:
51572
- styles = "list-style-type: lower-alpha;";
51805
+ styles2 = "list-style-type: lower-alpha;";
51573
51806
  break;
51574
51807
  case 3:
51575
51808
  case 6:
51576
- styles = "list-style-type: lower-roman;";
51809
+ styles2 = "list-style-type: lower-roman;";
51577
51810
  break;
51578
51811
  }
51579
51812
  } else {
51580
51813
  html = `<li>${html}</li>`;
51581
51814
  }
51582
51815
  if (isFirstListItem(editor, blockData, doc2, path)) {
51583
- html = `<${listTag}${styles ? ` style="${styles}"` : ""}>${html}`;
51816
+ html = `<${listTag}${styles2 ? ` style="${styles2}"` : ""}>${html}`;
51584
51817
  }
51585
51818
  if (isLastListItem(editor, blockData, doc2, path)) {
51586
51819
  html = `${html}</${listTag}>`;
@@ -62396,13 +62629,13 @@ $$${mathData.mathjaxText}$$
62396
62629
  if (!op.attributes) {
62397
62630
  return /* @__PURE__ */ new Map();
62398
62631
  }
62399
- const styles = Object.entries(op.attributes).filter(([key]) => {
62632
+ const styles2 = Object.entries(op.attributes).filter(([key]) => {
62400
62633
  if (key.startsWith("style-")) {
62401
62634
  return true;
62402
62635
  }
62403
62636
  return false;
62404
62637
  });
62405
- return new Map(styles);
62638
+ return new Map(styles2);
62406
62639
  };
62407
62640
  if (text2.length === 0) {
62408
62641
  return /* @__PURE__ */ new Map();
@@ -62446,11 +62679,11 @@ $$${mathData.mathjaxText}$$
62446
62679
  if (getTextLength(text2) === 0) {
62447
62680
  return textStyles;
62448
62681
  }
62449
- let styles = getIntersectionStyles(text2);
62450
- styles = mergeActiveStyle(editor, styles);
62682
+ let styles2 = getIntersectionStyles(text2);
62683
+ styles2 = mergeActiveStyle(editor, styles2);
62451
62684
  function getTextStyle(item) {
62452
62685
  const { id, icon, desc, name } = item;
62453
- const value = styles.get(id);
62686
+ const value = styles2.get(id);
62454
62687
  if (value !== void 0) {
62455
62688
  return {
62456
62689
  id,
@@ -63046,6 +63279,7 @@ $$${mathData.mathjaxText}$$
63046
63279
  GroupItemActions2["QuickReply"] = "quick-reply";
63047
63280
  GroupItemActions2["QuickReplyOk"] = "quick-reply-ok";
63048
63281
  GroupItemActions2["QuickReplyCancel"] = "quick-reply-cancel";
63282
+ GroupItemActions2["Resolve"] = "resolve";
63049
63283
  return GroupItemActions2;
63050
63284
  })(GroupItemActions || {});
63051
63285
  const GROUP_ITEM_ACTION_MARK = "group-item-action";
@@ -63093,7 +63327,7 @@ $$${mathData.mathjaxText}$$
63093
63327
  return attributes.filter((attribute) => attribute.startsWith("comment-")).map((attribute) => attribute.replace("comment-", ""));
63094
63328
  }
63095
63329
  const logger$1G = getLogger("doc-comments");
63096
- function addBlockComments(doc2, block, result, resultSet) {
63330
+ function addBlockComments$1(doc2, block, result, resultSet) {
63097
63331
  if (block.comments) {
63098
63332
  const blockComments = block.comments;
63099
63333
  if (Array.isArray(blockComments)) {
@@ -63129,7 +63363,7 @@ $$${mathData.mathjaxText}$$
63129
63363
  children.forEach((childContainerId) => {
63130
63364
  const childBlocks = doc2.blocks[childContainerId];
63131
63365
  childBlocks.forEach((subBlock) => {
63132
- addBlockComments(doc2, subBlock, result, resultSet);
63366
+ addBlockComments$1(doc2, subBlock, result, resultSet);
63133
63367
  });
63134
63368
  });
63135
63369
  }
@@ -63137,7 +63371,7 @@ $$${mathData.mathjaxText}$$
63137
63371
  const result = [];
63138
63372
  const resultSet = /* @__PURE__ */ new Set();
63139
63373
  doc2.blocks.root.forEach((block) => {
63140
- addBlockComments(doc2, block, result, resultSet);
63374
+ addBlockComments$1(doc2, block, result, resultSet);
63141
63375
  });
63142
63376
  const resultMap = /* @__PURE__ */ new Map();
63143
63377
  result.forEach((commentId, index2) => resultMap.set(commentId, index2));
@@ -63193,6 +63427,26 @@ $$${mathData.mathjaxText}$$
63193
63427
  });
63194
63428
  return result;
63195
63429
  }
63430
+ function getUnresolvedCommentsGroupFromDoc(editor, commentsProvider) {
63431
+ return getCommentsGroupFromDoc(editor, commentsProvider).filter((group) => !group.resolver);
63432
+ }
63433
+ function getResolvedCommentsGroupFromDoc(editor, commentsProvider) {
63434
+ const doc2 = editor.doc.toJSON();
63435
+ const commentsMap = getCommentsFromDoc(doc2);
63436
+ const commentGroup = getCommentsGroup(commentsProvider.getComments());
63437
+ const result = commentGroup.filter((group) => group.resolver).sort((group1, group2) => {
63438
+ var _a, _b, _c, _d;
63439
+ const date1 = (_b = (_a = group1.resolver) == null ? void 0 : _a.date) != null ? _b : 0;
63440
+ const date2 = (_d = (_c = group2.resolver) == null ? void 0 : _c.date) != null ? _d : 0;
63441
+ return date2 - date1;
63442
+ });
63443
+ result.forEach((group) => {
63444
+ if (!commentsMap.has(group.groupId)) {
63445
+ group.removedFromDoc = true;
63446
+ }
63447
+ });
63448
+ return result;
63449
+ }
63196
63450
  function flattenCommentGroup(comment) {
63197
63451
  const { children, ...raw } = comment;
63198
63452
  const comments = [raw];
@@ -63249,6 +63503,24 @@ $$${mathData.mathjaxText}$$
63249
63503
  const commentIds = intersection__default.default(comments1, comments2);
63250
63504
  return commentIds;
63251
63505
  }
63506
+ function removeUnresolvedComments(commentProvider, commentIds) {
63507
+ return commentIds.filter((commentId) => {
63508
+ const comment = commentProvider.getComment(commentId);
63509
+ if (!comment) {
63510
+ return false;
63511
+ }
63512
+ return !!comment.resolver;
63513
+ });
63514
+ }
63515
+ function removeResolvedComments(commentProvider, commentIds) {
63516
+ return commentIds.filter((commentId) => {
63517
+ const comment = commentProvider.getComment(commentId);
63518
+ if (!comment) {
63519
+ return false;
63520
+ }
63521
+ return !(comment == null ? void 0 : comment.resolver);
63522
+ });
63523
+ }
63252
63524
  const logger$1F = getLogger("active-comments");
63253
63525
  function inactiveComment(editor, commentId) {
63254
63526
  const activeCommentElements = editor.rootContainer.querySelectorAll(`span.comment[comment-${commentId}],[data-type=editor-block].comment[comment-${commentId}]`);
@@ -63304,6 +63576,11 @@ $$${mathData.mathjaxText}$$
63304
63576
  }
63305
63577
  }
63306
63578
  }
63579
+ function getElementsByCommentId(editor, commentId) {
63580
+ const lowerCommentId = commentId.toLocaleLowerCase();
63581
+ const elements = editor.rootContainer.querySelectorAll(`span.comment[comment-${lowerCommentId}],[data-type=editor-block].comment[comment-${lowerCommentId}]`);
63582
+ return Array.from(elements);
63583
+ }
63307
63584
  function isImageBlock(block) {
63308
63585
  return getBlockType(block) === "embed" && getEmbedType(block) === "image";
63309
63586
  }
@@ -68835,6 +69112,9 @@ ${codeText}
68835
69112
  okButton.disabled = false;
68836
69113
  }
68837
69114
  });
69115
+ __publicField(this, "handleClickLink", (editor, event, link2) => {
69116
+ this.options.mainEditor.emit("clickLink", editor, event, link2);
69117
+ });
68838
69118
  __publicField(this, "getCommentEditor", () => this.components.commentEditor);
68839
69119
  __publicField(this, "handleReadonlyChanged", (editor) => {
68840
69120
  if (editor.readonly) {
@@ -68905,6 +69185,7 @@ ${codeText}
68905
69185
  const commentEditor = new CommentEditor(editor, commentsProvider, this.doc);
68906
69186
  commentEditor.editor.addListener("readonlyChanged", this.handleEditorReadonlyChange);
68907
69187
  commentEditor.editor.addListener("docChanged", this.handleDocChanged);
69188
+ commentEditor.editor.addListener("clickLink", this.handleClickLink);
68908
69189
  commentEditor.editor.addListener("focus", this.handleFocus);
68909
69190
  commentEditor.editor.input.addHandler(new CommentEditorInputHandler(commentsProvider, groupItem, this));
68910
69191
  commentEditorContainer.append(commentEditor.root);
@@ -69036,8 +69317,9 @@ ${codeText}
69036
69317
  return items;
69037
69318
  }
69038
69319
  reloadList(data2) {
69320
+ this._items.forEach((item) => item.destroy());
69039
69321
  this.container.innerHTML = "";
69040
- this.createList(data2);
69322
+ this._items = this.createList(data2);
69041
69323
  }
69042
69324
  insertItem(data2) {
69043
69325
  const index2 = this.findInsertPos(data2);
@@ -69110,8 +69392,8 @@ ${codeText}
69110
69392
  });
69111
69393
  }
69112
69394
  }
69113
- 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>';
69114
- 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>';
69395
+ 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';
69396
+ 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';
69115
69397
  const index$8 = "";
69116
69398
  const REPLY_EDITOR_EDITING_CLS = "reply-editor-editing";
69117
69399
  const { t: t$3 } = i18n$1;
@@ -69234,6 +69516,9 @@ ${codeText}
69234
69516
  __publicField(this, "quickReply");
69235
69517
  __publicField(this, "createRoot", () => {
69236
69518
  const root2 = createElement("div", ["comment-group-item-root"], null);
69519
+ if (this.comment.resolver) {
69520
+ addClass(root2, "resolved");
69521
+ }
69237
69522
  return root2;
69238
69523
  });
69239
69524
  __publicField(this, "createChildrenList", () => {
@@ -69290,6 +69575,7 @@ ${codeText}
69290
69575
  this.mainItem = this.createItem();
69291
69576
  this.childrenList = this.createChildrenList();
69292
69577
  this.quickReply = this.createQuickReply();
69578
+ this.createFooter();
69293
69579
  this.editor.on("readonlyChanged", this.handleReadonlyChanged);
69294
69580
  this.resizeObserver = new index$g(this.handleResize);
69295
69581
  this.resizeObserver.observe(this.root);
@@ -69299,6 +69585,36 @@ ${codeText}
69299
69585
  const count = getCommentItemCountInGroupItem(this.root);
69300
69586
  return count;
69301
69587
  }
69588
+ createFooter() {
69589
+ if (!this.comment.resolver) {
69590
+ return null;
69591
+ }
69592
+ const footer = createElement("div", ["comment-item-footer"], this.root);
69593
+ const modified = createElement("span", ["comment-modified"], footer);
69594
+ const date = new Date(this.comment.modified);
69595
+ const resolver = this.comment.resolver;
69596
+ assert(logger$1h, resolver, "resolver should not be null");
69597
+ const text2 = i18n$1.t("comment.resolvedBy", { name: resolver.displayName, date: fromNowString(date) });
69598
+ modified.innerText = text2;
69599
+ const actions2 = createElement("div", ["comment-actions"], footer);
69600
+ createElement("span", ["comment-date"], actions2, fromNowString(new Date(resolver.date)));
69601
+ if (this.comment.removedFromDoc) {
69602
+ createElement("span", ["removed-tips"], actions2, i18n$1.t("comment.removedFromDoc"));
69603
+ } else {
69604
+ const reopen = createElement("button", ["comment-reopen"], actions2, i18n$1.t("comment.reopen"));
69605
+ reopen.onclick = () => {
69606
+ const editor = this.editor;
69607
+ const doc2 = editor.doc.toJSON();
69608
+ const commentsMap = getCommentsFromDoc(doc2);
69609
+ if (!commentsMap.has(this.comment.groupId)) {
69610
+ showToast(i18n$1.t("comment.commentHasAlreadyRemoved"));
69611
+ return;
69612
+ }
69613
+ this.commentsProvider.localUpdateCommentResolver(this.comment.id, void 0);
69614
+ };
69615
+ }
69616
+ return footer;
69617
+ }
69302
69618
  createQuickReply() {
69303
69619
  const { editor, commentsProvider, comment } = this;
69304
69620
  const commentQuickReply = new CommentQuickReply(editor, commentsProvider, comment, this);
@@ -69313,8 +69629,15 @@ ${codeText}
69313
69629
  const switchContainer = createElement("span", ["item-head-switch"], head);
69314
69630
  const switchUp = createTextButton(switchContainer, GroupItemActions.SwitchUp, "up", switchUpIcon);
69315
69631
  const switchDown = createTextButton(switchContainer, GroupItemActions.SwitchDown, "down", switchDownIcon);
69632
+ const resolve = createTextButton(switchContainer, GroupItemActions.Resolve, "resolve", CircleCheckMarkIcon);
69316
69633
  addGroupActionToElement(switchUp, GroupItemActions.SwitchUp);
69317
69634
  addGroupActionToElement(switchDown, GroupItemActions.SwitchDown);
69635
+ addGroupActionToElement(resolve, GroupItemActions.Resolve);
69636
+ resolve.setAttribute(`data-editor-tooltip-${this.editor.clientId}`, i18n$1.t("comment.resolveComment"));
69637
+ addClass(resolve, "disable-active");
69638
+ if (comment.resolver) {
69639
+ addClass(resolve, "resolved");
69640
+ }
69318
69641
  return head;
69319
69642
  }
69320
69643
  createItem() {
@@ -69354,6 +69677,7 @@ ${codeText}
69354
69677
  handleUpdateMainComment(comment) {
69355
69678
  assert(logger$1h, comment.id === this.mainItem.comment.id, "invalid comment");
69356
69679
  this.mainItem.reloadDoc();
69680
+ this.setCreatingComment(false);
69357
69681
  }
69358
69682
  deleteMainComment(commentId) {
69359
69683
  assert(logger$1h, commentId === this.mainItem.comment.id, "invalid comment");
@@ -69362,6 +69686,18 @@ ${codeText}
69362
69686
  edit() {
69363
69687
  this.mainItem.edit();
69364
69688
  }
69689
+ setCreatingComment(creating) {
69690
+ const resolveButton = this.header.querySelector('.editor-text-button[group-item-action="resolve"]');
69691
+ if (!resolveButton) {
69692
+ return;
69693
+ }
69694
+ resolveButton.disabled = creating;
69695
+ if (creating) {
69696
+ resolveButton.classList.add("disabled");
69697
+ } else {
69698
+ resolveButton.classList.remove("disabled");
69699
+ }
69700
+ }
69365
69701
  destroy() {
69366
69702
  this.quickReply.destroy();
69367
69703
  this.mainItem.destroy();
@@ -69547,7 +69883,21 @@ ${codeText}
69547
69883
  this.commentsProvider.localDeleteComment(comment.id);
69548
69884
  quickReply.show();
69549
69885
  });
69550
- __publicField(this, "execute", (element, groupItem, commentId, itemIndex) => {
69886
+ __publicField(this, "handleResolve", (groupItem) => {
69887
+ var _a;
69888
+ const { commentsProvider } = this;
69889
+ let comment = commentsProvider.getComment(groupItem.comment.id);
69890
+ if (!comment) {
69891
+ comment = (_a = groupItem.childrenList.items[0]) == null ? void 0 : _a.comment;
69892
+ }
69893
+ const user = this.groupList.editor.doc.getUser();
69894
+ commentsProvider.localUpdateCommentResolver(comment.id, {
69895
+ userId: user.userId,
69896
+ displayName: user.displayName,
69897
+ date: Date.now()
69898
+ });
69899
+ });
69900
+ __publicField(this, "execute", (element, groupItem, commentId, itemIndex, event) => {
69551
69901
  const actionElement = getClosestGroupItemActionElement(element);
69552
69902
  if (!actionElement)
69553
69903
  return;
@@ -69586,6 +69936,11 @@ ${codeText}
69586
69936
  case GroupItemActions.QuickReplyCancel:
69587
69937
  this.handleQuickReplyCancel(groupItem);
69588
69938
  break;
69939
+ case GroupItemActions.Resolve:
69940
+ event.preventDefault();
69941
+ event.stopPropagation();
69942
+ this.handleResolve(groupItem);
69943
+ break;
69589
69944
  default:
69590
69945
  const exhaustiveCheck = actionId;
69591
69946
  logger$1f.debug(`not implement handler for ${exhaustiveCheck}`);
@@ -69599,8 +69954,8 @@ ${codeText}
69599
69954
  }
69600
69955
  const logger$1e = getLogger("comment-group-list");
69601
69956
  class CommentGroupList extends ListBase {
69602
- constructor(editor, commentsProvider, parent) {
69603
- super(editor, commentsProvider, parent, getCommentsGroupFromDoc(editor, commentsProvider), {});
69957
+ constructor(editor, commentsProvider, parent, type) {
69958
+ super(editor, commentsProvider, parent, getUnresolvedCommentsGroupFromDoc(editor, commentsProvider), {});
69604
69959
  __publicField(this, "groupItemHandlers");
69605
69960
  __publicField(this, "dispatchScroll", debounce__default.default(() => {
69606
69961
  this.editor.scrollContainer.dispatchEvent(new Event("scroll"));
@@ -69638,7 +69993,9 @@ ${codeText}
69638
69993
  const commentId = getClosestCommentItemId(event.target);
69639
69994
  const index2 = this.items.findIndex((item) => item.root === itemRoot);
69640
69995
  if (index2 !== -1) {
69641
- if (this.activeIndex !== index2) {
69996
+ const disableActive = !!event.target.closest(".disable-active");
69997
+ const enableActive = !disableActive;
69998
+ if (this.activeIndex !== index2 && enableActive) {
69642
69999
  this.setActiveItem(index2);
69643
70000
  }
69644
70001
  const { groupItemHandlers } = this;
@@ -69646,7 +70003,8 @@ ${codeText}
69646
70003
  event.target,
69647
70004
  this.items[index2],
69648
70005
  commentId,
69649
- index2
70006
+ index2,
70007
+ event
69650
70008
  );
69651
70009
  }
69652
70010
  });
@@ -69687,7 +70045,7 @@ ${codeText}
69687
70045
  __publicField(this, "handleSelectionChanged", () => {
69688
70046
  setTimeout(() => {
69689
70047
  var _a;
69690
- const commentIds = getCommentsFromSelection(this.editor);
70048
+ const commentIds = this.type === "current" ? removeResolvedComments(this.commentsProvider, getCommentsFromSelection(this.editor)) : removeUnresolvedComments(this.commentsProvider, getCommentsFromSelection(this.editor));
69691
70049
  if (commentIds.length > 0) {
69692
70050
  if (((_a = this.activeItem) == null ? void 0 : _a.comment.id) && commentIds.includes(this.activeItem.comment.id)) {
69693
70051
  return;
@@ -69728,7 +70086,9 @@ ${codeText}
69728
70086
  const top = Number.parseFloat(firstItem.style.top);
69729
70087
  const targetTop = Number.parseFloat(firstItem.getAttribute("data-target-top") || "0");
69730
70088
  if (!Number.isNaN(top) && !Number.isNaN(targetTop) && top < targetTop) {
69731
- arrangeItems(this.editor, this.items, null, Math.min(top + (0 - event.deltaY) * 3, targetTop));
70089
+ if (this.type === "current") {
70090
+ arrangeItems(this.editor, this.items, null, Math.min(top + (0 - event.deltaY) * 3, targetTop));
70091
+ }
69732
70092
  }
69733
70093
  });
69734
70094
  __publicField(this, "updateGroupItemSwitch", () => {
@@ -69737,7 +70097,7 @@ ${codeText}
69737
70097
  activeItem.updateSwitchButton();
69738
70098
  });
69739
70099
  __publicField(this, "updateComments", debounce__default.default(() => {
69740
- const commentsGroup = getCommentsGroupFromDoc(this.editor, this.commentsProvider);
70100
+ const commentsGroup = this.type === "current" ? getUnresolvedCommentsGroupFromDoc(this.editor, this.commentsProvider) : getResolvedCommentsGroupFromDoc(this.editor, this.commentsProvider);
69741
70101
  let hasBeenChanged = false;
69742
70102
  for (let i = 0; i < commentsGroup.length; i++) {
69743
70103
  const comment = commentsGroup[i];
@@ -69760,6 +70120,8 @@ ${codeText}
69760
70120
  this.emit("commentCountChanged");
69761
70121
  }
69762
70122
  }, 100));
70123
+ this.editor = editor;
70124
+ this.type = type;
69763
70125
  this.updateItemsLayout();
69764
70126
  this.bindEvents();
69765
70127
  this.editor.addListener("selectionChanged", this.handleSelectionChanged);
@@ -69780,7 +70142,9 @@ ${codeText}
69780
70142
  document.removeEventListener("click", this.handleDocumentClick);
69781
70143
  }
69782
70144
  updateItemsLayout(dispatchScroll = true) {
69783
- arrangeItems(this.editor, this.items, this.activeItem);
70145
+ if (this.type === "current") {
70146
+ arrangeItems(this.editor, this.items, this.activeItem);
70147
+ }
69784
70148
  if (dispatchScroll) {
69785
70149
  this.dispatchScroll();
69786
70150
  }
@@ -69804,7 +70168,7 @@ ${codeText}
69804
70168
  return item;
69805
70169
  }
69806
70170
  findInsertPos(data2) {
69807
- const commentsMap = getCommentsGroupFromDoc(this.editor, this.commentsProvider);
70171
+ const commentsMap = getUnresolvedCommentsGroupFromDoc(this.editor, this.commentsProvider);
69808
70172
  const index2 = commentsMap.findIndex((group) => group.id === data2.id);
69809
70173
  if (index2 === -1) {
69810
70174
  return -1;
@@ -69904,6 +70268,7 @@ ${codeText}
69904
70268
  newItem.quickReply.hide();
69905
70269
  setTimeout(() => {
69906
70270
  newItem.edit();
70271
+ newItem.setCreatingComment(true);
69907
70272
  }, 300);
69908
70273
  }
69909
70274
  }
@@ -69928,6 +70293,12 @@ ${codeText}
69928
70293
  }
69929
70294
  }
69930
70295
  }
70296
+ handleResolveComment(commentId) {
70297
+ const item = this.findItem(commentId);
70298
+ if (item) {
70299
+ this.deleteItem(item.comment.id);
70300
+ }
70301
+ }
69931
70302
  handleUpdateComment(comment) {
69932
70303
  const group = this.findItemAsGroupId(comment.groupId);
69933
70304
  if (group && group.comment.id !== comment.id) {
@@ -69939,6 +70310,231 @@ ${codeText}
69939
70310
  item.handleUpdateMainComment(comment);
69940
70311
  }
69941
70312
  }
70313
+ changeType(type) {
70314
+ this.type = type;
70315
+ const comments = this.type === "current" ? getUnresolvedCommentsGroupFromDoc(this.editor, this.commentsProvider) : getResolvedCommentsGroupFromDoc(this.editor, this.commentsProvider);
70316
+ this.reloadList(comments);
70317
+ if (this.type === "current") {
70318
+ setTimeout(() => {
70319
+ arrangeItems(this.editor, this.items, null);
70320
+ });
70321
+ }
70322
+ }
70323
+ reloadList(data2) {
70324
+ super.reloadList(data2);
70325
+ this._items.forEach((item) => item.addListener("resize", this.handleItemResize));
70326
+ }
70327
+ }
70328
+ function addBlockComments(doc2, block, resultMap) {
70329
+ if (block.comments) {
70330
+ const blockComments = block.comments;
70331
+ if (Array.isArray(blockComments)) {
70332
+ blockComments.forEach((commentId) => {
70333
+ const commentIds = resultMap.get(block.id);
70334
+ if (commentIds) {
70335
+ commentIds.add(commentId);
70336
+ } else {
70337
+ resultMap.set(block.id, /* @__PURE__ */ new Set([commentId]));
70338
+ }
70339
+ });
70340
+ }
70341
+ }
70342
+ if (block.text) {
70343
+ const text2 = block.text;
70344
+ text2.forEach((op) => {
70345
+ if (op.attributes) {
70346
+ const prefix = "comment-";
70347
+ Object.entries(op.attributes).forEach(([key, value]) => {
70348
+ if (key.startsWith(prefix)) {
70349
+ const commentId = value;
70350
+ const commentIds = resultMap.get(block.id);
70351
+ if (commentIds) {
70352
+ commentIds.add(commentId);
70353
+ } else {
70354
+ resultMap.set(block.id, /* @__PURE__ */ new Set([commentId]));
70355
+ }
70356
+ }
70357
+ });
70358
+ }
70359
+ });
70360
+ }
70361
+ const children = block.children;
70362
+ if (!children) {
70363
+ return;
70364
+ }
70365
+ children.forEach((childContainerId) => {
70366
+ const childBlocks = doc2.blocks[childContainerId];
70367
+ childBlocks.forEach((subBlock) => {
70368
+ addBlockComments(doc2, subBlock, resultMap);
70369
+ });
70370
+ });
70371
+ }
70372
+ function getBlockCommentsFromDoc(doc2) {
70373
+ const resultMap = /* @__PURE__ */ new Map();
70374
+ doc2.blocks.root.forEach((block) => {
70375
+ addBlockComments(doc2, block, resultMap);
70376
+ });
70377
+ return resultMap;
70378
+ }
70379
+ function getBlocksByCommentId(doc2, commentId) {
70380
+ const result = [];
70381
+ const resultMap = getBlockCommentsFromDoc(doc2);
70382
+ resultMap.forEach((commentIds, blockId) => {
70383
+ if (commentIds.has(commentId)) {
70384
+ result.push(blockId);
70385
+ }
70386
+ });
70387
+ return result;
70388
+ }
70389
+ class OnesEditorCommentsRender {
70390
+ constructor(type = "current") {
70391
+ __publicField(this, "updateUnknownCommentsDelayed", debounce__default.default((editor) => {
70392
+ const comments = this.getComments(editor);
70393
+ const invisibleComments = Object.values(comments).filter((comment) => {
70394
+ const ret = this.type === "current" ? !!comment.resolver : !comment.resolver;
70395
+ return ret;
70396
+ });
70397
+ const root2 = editor.rootContainer;
70398
+ const effectedElements = /* @__PURE__ */ new Set();
70399
+ invisibleComments.forEach((comment) => {
70400
+ const key = `comment-${comment.groupId.toLocaleLowerCase()}`;
70401
+ const elements = root2.querySelectorAll(`[${key}]`);
70402
+ elements.forEach((elem) => {
70403
+ elem.removeAttribute(key);
70404
+ effectedElements.add(elem);
70405
+ });
70406
+ });
70407
+ effectedElements.forEach((elem) => {
70408
+ const commentAttributes = Array.from(elem.attributes).filter((a) => a.name.startsWith("comment-"));
70409
+ if (commentAttributes.length === 0) {
70410
+ elem.classList.remove("comment");
70411
+ }
70412
+ });
70413
+ }));
70414
+ this.type = type;
70415
+ }
70416
+ renderText(editor, path, attributes) {
70417
+ const classes = [];
70418
+ const textAttributes = {};
70419
+ Object.entries(attributes).forEach(([key, value]) => {
70420
+ if (key.startsWith("comment-")) {
70421
+ this.renderCommentElement(editor, key, value, classes, textAttributes);
70422
+ }
70423
+ });
70424
+ return { classes, attributes: textAttributes };
70425
+ }
70426
+ renderBox(editor, path, attributes) {
70427
+ const classes = [];
70428
+ const textAttributes = {};
70429
+ Object.entries(attributes).forEach(([key, value]) => {
70430
+ if (key.startsWith("comment-")) {
70431
+ this.renderCommentElement(editor, key, value, classes, textAttributes);
70432
+ }
70433
+ });
70434
+ return { classes, attributes: textAttributes };
70435
+ }
70436
+ renderBlock(editor, path, blockData) {
70437
+ const comments = blockData.comments;
70438
+ if (!comments || comments.length === 0) {
70439
+ return {};
70440
+ }
70441
+ const classes = [];
70442
+ const attributes = {};
70443
+ comments.forEach((commentId) => {
70444
+ const key = `comment-${commentId.toLocaleLowerCase()}`;
70445
+ this.renderCommentElement(editor, key, commentId, classes, attributes);
70446
+ });
70447
+ return {
70448
+ classes,
70449
+ attributes
70450
+ };
70451
+ }
70452
+ updateBlock(editor, path, blockElement, blockData) {
70453
+ const comments = blockData.comments;
70454
+ removeClass(blockElement, "comment");
70455
+ Array.from(blockElement.attributes).forEach((a) => {
70456
+ if (a.name.startsWith("comment-")) {
70457
+ blockElement.removeAttribute(a.name);
70458
+ }
70459
+ });
70460
+ if (!comments || comments.length === 0) {
70461
+ return;
70462
+ }
70463
+ addClass(blockElement, "comment");
70464
+ const classList = [];
70465
+ comments.forEach((commentId) => {
70466
+ const key = `comment-${commentId.toLocaleLowerCase()}`;
70467
+ this.renderCommentElement(editor, key, commentId, classList, {});
70468
+ });
70469
+ if (classList.length > 0) {
70470
+ addClass(blockElement, ...classList);
70471
+ }
70472
+ }
70473
+ getCommentStatus(editor, commentId) {
70474
+ const comments = editor.findCustom("editor-comments");
70475
+ if (!comments) {
70476
+ return "unknown";
70477
+ }
70478
+ const commentsProvider = comments.commentProvider;
70479
+ const comment = commentsProvider.getComment(commentId);
70480
+ if (!comment) {
70481
+ return "unknown";
70482
+ }
70483
+ if (comment.resolver) {
70484
+ return "resolved";
70485
+ }
70486
+ return "unresolved";
70487
+ }
70488
+ renderCommentElement(editor, key, commentId, classes, textAttributes) {
70489
+ const status = this.getCommentStatus(editor, commentId);
70490
+ if (this.type === "current") {
70491
+ if (status === "resolved") {
70492
+ return;
70493
+ }
70494
+ } else {
70495
+ if (status === "unresolved") {
70496
+ return;
70497
+ }
70498
+ }
70499
+ classes.push("comment");
70500
+ textAttributes[key] = commentId;
70501
+ if (status === "unknown") {
70502
+ this.updateUnknownCommentsDelayed(editor);
70503
+ }
70504
+ }
70505
+ getComments(editor) {
70506
+ const editorComments = editor.findCustom("editor-comments");
70507
+ if (!editorComments) {
70508
+ return [];
70509
+ }
70510
+ const commentProvider = editorComments.commentProvider;
70511
+ return commentProvider.getComments();
70512
+ }
70513
+ changeType(editor, type) {
70514
+ this.type = type;
70515
+ const elements = editor.rootContainer.querySelectorAll(".comment");
70516
+ elements.forEach((elem) => {
70517
+ elem.classList.remove("comment");
70518
+ Array.from(elem.attributes).forEach((a) => {
70519
+ if (a.name.startsWith("comment-")) {
70520
+ elem.removeAttribute(a.name);
70521
+ }
70522
+ });
70523
+ });
70524
+ const comments = this.getComments(editor);
70525
+ const resolvedCommentsId = new Set(Object.values(comments).filter((comment) => !!comment.resolver).map((comment) => comment.groupId));
70526
+ const unresolvedCommentsId = new Set(Object.values(comments).filter((comment) => !resolvedCommentsId.has(comment.groupId)).map((comment) => comment.groupId));
70527
+ const visibleCommentsId = type === "current" ? unresolvedCommentsId : resolvedCommentsId;
70528
+ const commentsFromDoc = getBlockCommentsFromDoc(editor.doc.toJSON());
70529
+ commentsFromDoc.forEach((commentIds, blockId) => {
70530
+ if (Array.from(commentIds).some((c) => visibleCommentsId.has(c))) {
70531
+ const block = editor.findBlockById(blockId);
70532
+ if (block) {
70533
+ editor.reloadBlock(block);
70534
+ }
70535
+ }
70536
+ });
70537
+ }
69942
70538
  }
69943
70539
  const COMMENT_MINI_CLS = "comment-mini";
69944
70540
  getLogger("comment-list");
@@ -69948,6 +70544,44 @@ ${codeText}
69948
70544
  __publicField(this, "root");
69949
70545
  __publicField(this, "groupsContainer");
69950
70546
  __publicField(this, "list");
70547
+ __publicField(this, "listType", "current");
70548
+ __publicField(this, "switcherItem", {
70549
+ id: "switch-comment",
70550
+ name: i18n$1.t("comment.currentComment"),
70551
+ dropdown: true,
70552
+ manualShowChildren: true,
70553
+ childrenPlacement: "bottom-start",
70554
+ children: [{
70555
+ id: "current-comment",
70556
+ name: i18n$1.t("comment.currentComment"),
70557
+ states: ["checked"]
70558
+ }, {
70559
+ id: "resolved-comment",
70560
+ name: i18n$1.t("comment.resolvedComment")
70561
+ }]
70562
+ });
70563
+ __publicField(this, "switcherBar");
70564
+ __publicField(this, "noResolvedCommentTip", null);
70565
+ __publicField(this, "handleSwitchType", (bar2, item) => {
70566
+ if (item.id === "current-comment") {
70567
+ this.listType = "current";
70568
+ } else {
70569
+ this.listType = "resolved";
70570
+ }
70571
+ this.editor.rootContainer.setAttribute("comment-list-type", this.listType);
70572
+ this.root.setAttribute("list-type", this.listType);
70573
+ this.switcherItem.name = this.listType === "current" ? i18n$1.t("comment.currentComment") : i18n$1.t("comment.resolvedComment");
70574
+ const children = this.switcherItem.children;
70575
+ children[0].states = this.listType === "current" ? ["checked"] : [];
70576
+ children[1].states = this.listType === "resolved" ? ["checked"] : [];
70577
+ this.switcherBar.updateItems([this.switcherItem]);
70578
+ this.list.changeType(this.listType);
70579
+ const renderer = this.editor.editorBlockRenders.getRenderers().find((r) => r instanceof OnesEditorCommentsRender);
70580
+ if (renderer) {
70581
+ renderer.changeType(this.editor, this.listType);
70582
+ }
70583
+ this.updateNoResolvedCommentTip();
70584
+ });
69951
70585
  __publicField(this, "handleSelectionOnComment", () => {
69952
70586
  this.emit("onSelectComment");
69953
70587
  });
@@ -69955,8 +70589,12 @@ ${codeText}
69955
70589
  var _a, _b;
69956
70590
  const count = getCommentsCountInDoc(this.editor, this.commentsProvider);
69957
70591
  (_b = (_a = this.commentOptions) == null ? void 0 : _a.onCommentCountChange) == null ? void 0 : _b.call(_a, count);
70592
+ this.updateNoResolvedCommentTip();
69958
70593
  });
69959
70594
  __publicField(this, "handleActiveItemChanged", (index2, direction) => {
70595
+ if (this.listType === "resolved") {
70596
+ return;
70597
+ }
69960
70598
  setTimeout(() => {
69961
70599
  var _a, _b;
69962
70600
  const item = this.list.activeItem;
@@ -69973,13 +70611,19 @@ ${codeText}
69973
70611
  this.editor = editor;
69974
70612
  this.commentsProvider = commentsProvider;
69975
70613
  this.root = createElement("div", ["editor-web-comment-root"], null);
70614
+ this.root.setAttribute("list-type", this.listType);
69976
70615
  this.groupsContainer = createElement("div", ["comment-groups-container"], this.root);
69977
70616
  this.list = this.createList();
70617
+ this.switcherBar = this.createSwitcher();
69978
70618
  this.commentsProvider.addListener(this);
69979
70619
  this.list.addListener("activeItemChanged", this.handleActiveItemChanged);
69980
70620
  this.list.addListener("itemLayoutUpdated", this.handleItemLayoutUpdated);
69981
70621
  this.list.addListener("selectionOnComment", this.handleSelectionOnComment);
69982
70622
  this.list.addListener("commentCountChanged", this.updateCommentCount);
70623
+ if (!this.editor.options.enableResolveComments) {
70624
+ this.root.classList.add("disable-resolve");
70625
+ }
70626
+ this.editor.rootContainer.setAttribute("comment-list-type", this.listType);
69983
70627
  this.updateCommentCount();
69984
70628
  }
69985
70629
  get commentOptions() {
@@ -69987,10 +70631,13 @@ ${codeText}
69987
70631
  return commentOptions;
69988
70632
  }
69989
70633
  destroy() {
70634
+ var _a;
69990
70635
  this.list.removeAllListeners();
69991
70636
  this.commentsProvider.removeListener(this);
69992
70637
  this.list.destroy();
69993
70638
  this.root.remove();
70639
+ this.switcherBar.destroy();
70640
+ (_a = this.noResolvedCommentTip) == null ? void 0 : _a.remove();
69994
70641
  }
69995
70642
  onCreateComment(commentId, local) {
69996
70643
  const comment = this.commentsProvider.getComment(commentId);
@@ -70005,8 +70652,73 @@ ${codeText}
70005
70652
  const comment = this.commentsProvider.getComment(commentId);
70006
70653
  this.list.handleUpdateComment(comment);
70007
70654
  }
70655
+ onUpdateCommentResolver(commentId, local) {
70656
+ const comment = this.commentsProvider.getComment(commentId);
70657
+ if (!comment) {
70658
+ return;
70659
+ }
70660
+ let type = "add";
70661
+ if (this.listType === "current") {
70662
+ if (comment.resolver) {
70663
+ type = "remove";
70664
+ }
70665
+ } else {
70666
+ if (!comment.resolver) {
70667
+ type = "remove";
70668
+ }
70669
+ }
70670
+ const blocks = /* @__PURE__ */ new Set();
70671
+ if (type === "remove") {
70672
+ getElementsByCommentId(this.editor, comment.groupId).forEach((element) => {
70673
+ if (isBlock$1(element)) {
70674
+ blocks.add(element);
70675
+ } else {
70676
+ const block = getParentBlock(element);
70677
+ if (block) {
70678
+ blocks.add(block);
70679
+ }
70680
+ }
70681
+ });
70682
+ } else {
70683
+ const blockIds = getBlocksByCommentId(this.editor.doc.toJSON(), comment.groupId);
70684
+ blockIds.forEach((blockId) => {
70685
+ const block = this.editor.findBlockById(blockId);
70686
+ if (block) {
70687
+ blocks.add(block);
70688
+ }
70689
+ });
70690
+ }
70691
+ blocks.forEach((block) => {
70692
+ this.editor.reloadBlock(block);
70693
+ });
70694
+ const commentGroup = getCommentsGroup(this.commentsProvider.getComments());
70695
+ const commentWithChildren = commentGroup.find((group) => group.groupId === comment.groupId);
70696
+ if (!commentWithChildren) {
70697
+ return;
70698
+ }
70699
+ setTimeout(() => {
70700
+ if (type === "add") {
70701
+ this.list.handleCreateComment(commentWithChildren, local);
70702
+ } else {
70703
+ this.list.handleResolveComment(comment.groupId);
70704
+ }
70705
+ this.updateCommentCount();
70706
+ }, 300);
70707
+ }
70008
70708
  createList() {
70009
- return new CommentGroupList(this.editor, this.commentsProvider, this.groupsContainer);
70709
+ return new CommentGroupList(this.editor, this.commentsProvider, this.groupsContainer, this.listType);
70710
+ }
70711
+ createSwitcher() {
70712
+ const container = createElement("div", ["comment-switcher-container"], this.root);
70713
+ const commandBar2 = new FixedToolbar(container, [this.switcherItem], {
70714
+ id: "comment-switcher"
70715
+ });
70716
+ commandBar2.addListener("click", this.handleSwitchType);
70717
+ return commandBar2;
70718
+ }
70719
+ setSwitcherParent(parent) {
70720
+ this.switcherBar.content.remove();
70721
+ parent.append(this.switcherBar.content);
70010
70722
  }
70011
70723
  isEditing(includeEmpty) {
70012
70724
  return this.list.isEditing(includeEmpty);
@@ -70014,14 +70726,40 @@ ${codeText}
70014
70726
  setFirstEditingCommentActive() {
70015
70727
  this.list.setFirstEditingCommentActive();
70016
70728
  }
70017
- show(groupId) {
70729
+ setListType(type) {
70730
+ var _a, _b;
70731
+ if (type === "resolved") {
70732
+ const item = (_a = this.switcherItem.children) == null ? void 0 : _a[1];
70733
+ this.handleSwitchType(this.switcherBar, item);
70734
+ } else {
70735
+ const item = (_b = this.switcherItem.children) == null ? void 0 : _b[0];
70736
+ this.handleSwitchType(this.switcherBar, item);
70737
+ }
70738
+ }
70739
+ updateNoResolvedCommentTip() {
70018
70740
  var _a;
70741
+ if (this.listType === "resolved" && this.list.items.length === 0) {
70742
+ if (!this.noResolvedCommentTip) {
70743
+ this.noResolvedCommentTip = createElement("div", ["comment-no-resolved-tip"], this.groupsContainer);
70744
+ this.noResolvedCommentTip.innerText = i18n$1.t("comment.noResolvedComment");
70745
+ }
70746
+ return;
70747
+ }
70748
+ (_a = this.noResolvedCommentTip) == null ? void 0 : _a.remove();
70749
+ this.noResolvedCommentTip = null;
70750
+ }
70751
+ show(groupId) {
70752
+ var _a, _b;
70019
70753
  removeClass(this.root, "hidden");
70020
70754
  if (groupId) {
70755
+ if (this.listType !== "current") {
70756
+ const commandItem = (_a = this.switcherItem.children) == null ? void 0 : _a[0];
70757
+ this.handleSwitchType(this.switcherBar, commandItem);
70758
+ }
70021
70759
  const index2 = this.list.findItemIndex(groupId);
70022
70760
  this.list.setActiveItem(index2);
70023
70761
  }
70024
- (_a = this.commentOptions) == null ? void 0 : _a.controller.showCommentList();
70762
+ (_b = this.commentOptions) == null ? void 0 : _b.controller.showCommentList();
70025
70763
  }
70026
70764
  hide() {
70027
70765
  addClass(this.root, "hidden");
@@ -70149,7 +70887,7 @@ ${codeText}
70149
70887
  const logger$1c = getLogger("mobile-group-list");
70150
70888
  class MobileGroupList extends ListBase {
70151
70889
  constructor(editor, commentsProvider, parent, scrollElement) {
70152
- super(editor, commentsProvider, parent, getCommentsGroupFromDoc(editor, commentsProvider), {});
70890
+ super(editor, commentsProvider, parent, getUnresolvedCommentsGroupFromDoc(editor, commentsProvider), {});
70153
70891
  __publicField(this, "scroller");
70154
70892
  __publicField(this, "refreshScroller", () => {
70155
70893
  this.scroller.refresh();
@@ -70197,7 +70935,7 @@ ${codeText}
70197
70935
  this.updateComments();
70198
70936
  });
70199
70937
  __publicField(this, "updateComments", debounce__default.default(() => {
70200
- const commentsGroup = getCommentsGroupFromDoc(this.editor, this.commentsProvider);
70938
+ const commentsGroup = getUnresolvedCommentsGroupFromDoc(this.editor, this.commentsProvider);
70201
70939
  for (let i = 0; i < commentsGroup.length; i++) {
70202
70940
  const comment = commentsGroup[i];
70203
70941
  const groupItem = this.findGroupItem(comment.groupId);
@@ -70231,7 +70969,7 @@ ${codeText}
70231
70969
  return item;
70232
70970
  }
70233
70971
  findInsertPos(data2) {
70234
- const commentsMap = getCommentsGroupFromDoc(this.editor, this.commentsProvider);
70972
+ const commentsMap = getUnresolvedCommentsGroupFromDoc(this.editor, this.commentsProvider);
70235
70973
  const index2 = commentsMap.findIndex((group) => group.id === data2.id);
70236
70974
  if (index2 === -1) {
70237
70975
  return -1;
@@ -70367,6 +71105,8 @@ ${codeText}
70367
71105
  const comment = this.commentsProvider.getComment(commentId);
70368
71106
  this.list.handleUpdateComment(comment);
70369
71107
  }
71108
+ onUpdateCommentResolver(commentId, local) {
71109
+ }
70370
71110
  get commentOptions() {
70371
71111
  const commentOptions = this.editor.getComponentOptions("comment");
70372
71112
  return commentOptions;
@@ -70392,7 +71132,7 @@ ${codeText}
70392
71132
  }
70393
71133
  }
70394
71134
  function getMiniCommentsGroupFromDoc(editor, commentsProvider) {
70395
- const commentsGroupFromDoc = getCommentsGroupFromDoc(editor, commentsProvider);
71135
+ const commentsGroupFromDoc = getUnresolvedCommentsGroupFromDoc(editor, commentsProvider);
70396
71136
  const miniCommentGroups = /* @__PURE__ */ new Map();
70397
71137
  for (const commentGroup of commentsGroupFromDoc) {
70398
71138
  const blockId = getBlockIdByGroupId(editor, commentGroup.groupId);
@@ -70539,6 +71279,9 @@ ${codeText}
70539
71279
  }
70540
71280
  onUpdateComment(commentId, local) {
70541
71281
  }
71282
+ onUpdateCommentResolver(commentId, local) {
71283
+ this.list.updateMiniCommentsGroup();
71284
+ }
70542
71285
  show() {
70543
71286
  removeClass(this.root, "hidden");
70544
71287
  }
@@ -70767,12 +71510,18 @@ ${codeText}
70767
71510
  (_b = this.commentList) == null ? void 0 : _b.show(groupId);
70768
71511
  }
70769
71512
  });
70770
- __publicField(this, "showCommentList", (groupId) => {
71513
+ __publicField(this, "showCommentList", (groupId, type) => {
71514
+ var _a, _b;
70771
71515
  if (this.isMobile) {
70772
71516
  this.showComment("mobile", groupId);
70773
71517
  } else {
70774
71518
  this.showComment("web", groupId);
70775
71519
  }
71520
+ if (type) {
71521
+ (_a = this.getCommentList()) == null ? void 0 : _a.setListType(type);
71522
+ } else if (type === void 0) {
71523
+ (_b = this.getCommentList()) == null ? void 0 : _b.setListType("current");
71524
+ }
70776
71525
  });
70777
71526
  __publicField(this, "handleCommentListClose", () => {
70778
71527
  this.showComment("mini");
@@ -70807,6 +71556,15 @@ ${codeText}
70807
71556
  get isMobile() {
70808
71557
  return clientType.isMobile;
70809
71558
  }
71559
+ getCommentList() {
71560
+ return this.commentList;
71561
+ }
71562
+ getMobileCommentList() {
71563
+ return this.mobileCommentList;
71564
+ }
71565
+ getMiniCommentList() {
71566
+ return this.miniCommentList;
71567
+ }
70810
71568
  destroy() {
70811
71569
  var _a, _b;
70812
71570
  (_a = this.commentList) == null ? void 0 : _a.destroy();
@@ -70832,6 +71590,9 @@ ${codeText}
70832
71590
  if (containers.mobileContainer && this.mobileCommentList) {
70833
71591
  containers.mobileContainer.append(this.mobileCommentList.root);
70834
71592
  }
71593
+ if (containers.switchBarContainer && this.commentList) {
71594
+ this.commentList.setSwitcherParent(containers.switchBarContainer);
71595
+ }
70835
71596
  }
70836
71597
  }
70837
71598
  const style$7 = "";
@@ -70855,7 +71616,15 @@ ${codeText}
70855
71616
  more: "\u66F4\u591A",
70856
71617
  comment: "\u6DFB\u52A0\u6279\u6CE8",
70857
71618
  command: "\u6DFB\u52A0\u6279\u6CE8",
70858
- quickMenuCommand: "\u6DFB\u52A0\u6279\u6CE8"
71619
+ quickMenuCommand: "\u6DFB\u52A0\u6279\u6CE8",
71620
+ resolvedBy: "\u5DF2\u7531 {name} \u6210\u5458\u89E3\u51B3",
71621
+ reopen: "\u91CD\u65B0\u6253\u5F00",
71622
+ currentComment: "\u5F53\u524D\u6279\u6CE8",
71623
+ resolvedComment: "\u5DF2\u89E3\u51B3\u6279\u6CE8",
71624
+ removedFromDoc: "\u5F15\u7528\u5185\u5BB9\u5DF2\u5220\u9664",
71625
+ noResolvedComment: "\u65E0\u5DF2\u89E3\u51B3\u6279\u6CE8",
71626
+ resolveComment: "\u6807\u8BB0\u4E3A\u5DF2\u89E3\u51B3",
71627
+ commentHasAlreadyRemoved: "\u5F15\u7528\u5185\u5BB9\u5DF2\u88AB\u5220\u9664\uFF0C\u4E0D\u53EF\u91CD\u65B0\u6253\u5F00\u6279\u6CE8"
70859
71628
  }
70860
71629
  };
70861
71630
  const enUS$k = {
@@ -70878,7 +71647,15 @@ ${codeText}
70878
71647
  more: "More",
70879
71648
  comment: "Add annotation",
70880
71649
  command: "Add annotation",
70881
- quickMenuCommand: "Add annotation"
71650
+ quickMenuCommand: "Add annotation",
71651
+ resolvedBy: "Resolved by {name}",
71652
+ reopen: "Reopen",
71653
+ currentComment: "Unresolved annotations",
71654
+ resolvedComment: "Resolved annotations",
71655
+ removedFromDoc: "Quoted content deleted.",
71656
+ noResolvedComment: "No resolved annotations.",
71657
+ resolveComment: "Mark as resolved",
71658
+ commentHasAlreadyRemoved: "Referenced content deleted. Comment can't be reopened."
70882
71659
  }
70883
71660
  };
70884
71661
  const jaJP$k = {
@@ -70901,7 +71678,15 @@ ${codeText}
70901
71678
  more: "\u305D\u306E\u4ED6",
70902
71679
  comment: "\u6CE8\u91C8\u3092\u8FFD\u52A0",
70903
71680
  command: "\u6CE8\u91C8\u3092\u8FFD\u52A0",
70904
- quickMenuCommand: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
71681
+ quickMenuCommand: "\u6CE8\u91C8\u3092\u8FFD\u52A0",
71682
+ resolvedBy: "{name}\u3055\u3093\u304C\u89E3\u6C7A\u3057\u307E\u3057\u305F",
71683
+ reopen: "\u518D\u958B",
71684
+ currentComment: "\u672A\u89E3\u6C7A\u30B3\u30E1\u30F3\u30C8",
71685
+ resolvedComment: "\u89E3\u6C7A\u6E08\u307F\u30B3\u30E1\u30F3\u30C8",
71686
+ removedFromDoc: "\u5F15\u7528\u3055\u308C\u305F\u5185\u5BB9\u306F\u524A\u9664\u3055\u308C\u307E\u3057\u305F\u3002",
71687
+ noResolvedComment: "\u89E3\u6C7A\u6E08\u307F\u30B3\u30E1\u30F3\u30C8\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
71688
+ resolveComment: "\u89E3\u6C7A\u3055\u308C\u307E\u3057\u305F",
71689
+ 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"
70905
71690
  }
70906
71691
  };
70907
71692
  i18n$1.mergeLang({
@@ -70909,61 +71694,6 @@ ${codeText}
70909
71694
  "en-US": enUS$k,
70910
71695
  "ja-JP": jaJP$k
70911
71696
  });
70912
- class OnesEditorCommentsRender {
70913
- renderText(editor, path, attributes) {
70914
- const classes = [];
70915
- const textAttributes = {};
70916
- Object.entries(attributes).forEach(([key, value]) => {
70917
- if (key.startsWith("comment-")) {
70918
- classes.push("comment");
70919
- textAttributes[key] = value;
70920
- }
70921
- });
70922
- return { classes, attributes: textAttributes };
70923
- }
70924
- renderBox(editor, path, attributes) {
70925
- const classes = [];
70926
- const textAttributes = {};
70927
- Object.entries(attributes).forEach(([key, value]) => {
70928
- if (key.startsWith("comment-")) {
70929
- classes.push("comment");
70930
- textAttributes[key] = value;
70931
- }
70932
- });
70933
- return { classes, attributes: textAttributes };
70934
- }
70935
- renderBlock(editor, path, blockData) {
70936
- const comments = blockData.comments;
70937
- if (!comments || comments.length === 0) {
70938
- return {};
70939
- }
70940
- const classes = ["comment"];
70941
- const attributes = {};
70942
- comments.forEach((commentId) => {
70943
- attributes[`comment-${commentId.toLocaleLowerCase()}`] = commentId;
70944
- });
70945
- return {
70946
- classes,
70947
- attributes
70948
- };
70949
- }
70950
- updateBlock(editor, path, blockElement, blockData) {
70951
- const comments = blockData.comments;
70952
- removeClass(blockElement, "comment");
70953
- Array.from(blockElement.attributes).forEach((a) => {
70954
- if (a.name.startsWith("comment-")) {
70955
- blockElement.removeAttribute(a.name);
70956
- }
70957
- });
70958
- if (!comments || comments.length === 0) {
70959
- return;
70960
- }
70961
- addClass(blockElement, "comment");
70962
- comments.forEach((commentId) => {
70963
- blockElement.setAttribute(`comment-${commentId.toLocaleLowerCase()}`, commentId);
70964
- });
70965
- }
70966
- }
70967
71697
  class OnesEditorCommentPlaceholderHandler {
70968
71698
  constructor(editor) {
70969
71699
  __publicField(this, "handleUpdateCompositionText", (editor, containerId, blockIndex, offset, end) => {
@@ -71115,6 +71845,21 @@ ${codeText}
71115
71845
  method: "delete"
71116
71846
  });
71117
71847
  }
71848
+ function updateCommentResolverToOldDoc(editor, version, commentId, resolver) {
71849
+ var _a, _b;
71850
+ const doc2 = editor.doc;
71851
+ const server = (_b = (_a = doc2.getServerMeta) == null ? void 0 : _a.call(doc2)) == null ? void 0 : _b.apiServer;
71852
+ assert(logger$16, server, "apiServer is not set");
71853
+ const api = `${server}/${version}/comments/${commentId}/resolver`;
71854
+ return doc2.request(api, {
71855
+ method: "put",
71856
+ data: {
71857
+ resolver
71858
+ }
71859
+ });
71860
+ }
71861
+ getLogger("resolved-comment-item");
71862
+ const styles = "";
71118
71863
  const isAllContainersSelected = (editor) => {
71119
71864
  var _a;
71120
71865
  const range = editor.selection.range;
@@ -71189,6 +71934,16 @@ ${codeText}
71189
71934
  await updateCommentToOldDoc(this.editor, this.version, commentId, comments.commentProvider.getCommentDoc(commentId));
71190
71935
  }
71191
71936
  }
71937
+ onUpdateCommentResolver(commentId, local) {
71938
+ const comments = this.editor.getCustom("editor-comments");
71939
+ const provider = comments.commentProvider;
71940
+ const comment = provider.getComment(commentId);
71941
+ if (!comment) {
71942
+ return;
71943
+ }
71944
+ const resolver = comment.resolver;
71945
+ updateCommentResolverToOldDoc(this.editor, this.version, commentId, resolver);
71946
+ }
71192
71947
  hideToolbar(editor) {
71193
71948
  const toolbar2 = editor.findCustom("toolbar-handler");
71194
71949
  toolbar2 == null ? void 0 : toolbar2.disableTextToolbar();
@@ -71215,6 +71970,7 @@ ${codeText}
71215
71970
  order: 60
71216
71971
  }],
71217
71972
  executeCommand: (editor2, block, item, child2) => {
71973
+ var _a2;
71218
71974
  if (!child2) {
71219
71975
  return;
71220
71976
  }
@@ -71225,6 +71981,7 @@ ${codeText}
71225
71981
  }
71226
71982
  this.hideToolbar(editor2);
71227
71983
  comments.showCommentList();
71984
+ (_a2 = comments.getCommentList()) == null ? void 0 : _a2.setListType("current");
71228
71985
  const offset = getChildOffset(block, child2);
71229
71986
  const range = createBlockSimpleRange(this.editor, block, offset.start, offset.end);
71230
71987
  const comment = addCommentToTextBlocks(editor2, range, comments.commentProvider);
@@ -71249,15 +72006,16 @@ ${codeText}
71249
72006
  order: 60
71250
72007
  }],
71251
72008
  executeCommand: (editor2, block, item) => {
72009
+ var _a2;
71252
72010
  if (item.id === "add-comment-to-old-doc") {
71253
72011
  const comments = editor2.getCustom("editor-comments");
71254
72012
  if (!comments) {
71255
72013
  return;
71256
72014
  }
71257
72015
  editor2.selection.selectBlock(block, 0, getBlockTextLength$6(editor2, block), { noScroll: true });
71258
- const editorComments = editor2.getCustom("editor-comments");
71259
- editorComments.showCommentList();
71260
- addCommentToBlock(editor2, block, editorComments.commentProvider);
72016
+ comments.showCommentList();
72017
+ (_a2 = comments.getCommentList()) == null ? void 0 : _a2.setListType("current");
72018
+ addCommentToBlock(editor2, block, comments.commentProvider);
71261
72019
  }
71262
72020
  }
71263
72021
  };
@@ -71282,12 +72040,14 @@ ${codeText}
71282
72040
  }];
71283
72041
  }
71284
72042
  executeCommand(editor, command, options) {
72043
+ var _a;
71285
72044
  if (command.id === "add-comment-to-old-doc/text") {
71286
72045
  const comments = editor.getCustom("editor-comments");
71287
72046
  if (!comments) {
71288
72047
  return;
71289
72048
  }
71290
72049
  comments.showCommentList();
72050
+ (_a = comments.getCommentList()) == null ? void 0 : _a.setListType("current");
71291
72051
  const range = editor.selection.range;
71292
72052
  if (!range.isSimple()) {
71293
72053
  if (isFullSelectedOneComplexBlock(editor, range)) {
@@ -76501,14 +77261,14 @@ ${docStr}
76501
77261
  }
76502
77262
  function isList(elem) {
76503
77263
  var _a;
76504
- const styles = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
76505
- return styles.findIndex((style2) => style2.startsWith("level")) !== -1;
77264
+ const styles2 = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
77265
+ return styles2.findIndex((style2) => style2.startsWith("level")) !== -1;
76506
77266
  }
76507
77267
  function getOfficeListGroupId(elem) {
76508
77268
  var _a;
76509
- const styles = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
76510
- for (let i = 0; i < styles.length; i++) {
76511
- const name = styles[i];
77269
+ const styles2 = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
77270
+ for (let i = 0; i < styles2.length; i++) {
77271
+ const name = styles2[i];
76512
77272
  if (name.startsWith("mso-list:")) {
76513
77273
  return name;
76514
77274
  }
@@ -76517,9 +77277,9 @@ ${docStr}
76517
77277
  }
76518
77278
  function getLevel(elem) {
76519
77279
  var _a, _b;
76520
- const styles = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
76521
- for (let i = 0; i < styles.length; i++) {
76522
- const name = styles[i];
77280
+ const styles2 = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
77281
+ for (let i = 0; i < styles2.length; i++) {
77282
+ const name = styles2[i];
76523
77283
  if (name.startsWith("level")) {
76524
77284
  const level = (_b = Number.parseInt(name.substring(5), 10)) != null ? _b : void 0;
76525
77285
  if (level) {
@@ -80123,6 +80883,8 @@ ${docStr}
80123
80883
  }
80124
80884
  onUpdateComment() {
80125
80885
  }
80886
+ onUpdateCommentResolver(commentId, local) {
80887
+ }
80126
80888
  }
80127
80889
  async function playHistoryData(doc2, versionHelper, historyData) {
80128
80890
  for (const data2 of historyData) {
@@ -90294,6 +91056,9 @@ ${data2.plantumlText}
90294
91056
  localUpdateComment(comment, doc2) {
90295
91057
  this.doc.localUpdateComment(comment, doc2);
90296
91058
  }
91059
+ localUpdateCommentResolver(commentId, resolver) {
91060
+ this.doc.localUpdateCommentResolver(commentId, resolver);
91061
+ }
90297
91062
  onCreateComment(commentId, local) {
90298
91063
  Array.from(this.listeners.values()).forEach((listener) => listener.onCreateComment(commentId, local));
90299
91064
  }
@@ -90303,6 +91068,9 @@ ${data2.plantumlText}
90303
91068
  onUpdateComment(commentId, local) {
90304
91069
  Array.from(this.listeners.values()).forEach((listener) => listener.onUpdateComment(commentId, local));
90305
91070
  }
91071
+ onUpdateCommentResolver(commentId, local) {
91072
+ Array.from(this.listeners.values()).forEach((listener) => listener.onUpdateCommentResolver(commentId, local));
91073
+ }
90306
91074
  addListener(callback) {
90307
91075
  this.listeners.add(callback);
90308
91076
  }
@@ -90328,9 +91096,10 @@ ${data2.plantumlText}
90328
91096
  constructor(editor, localDoc) {
90329
91097
  __publicField(this, "_listeners", /* @__PURE__ */ new Set());
90330
91098
  __publicField(this, "_doc");
91099
+ var _a, _b;
90331
91100
  this.editor = editor;
90332
91101
  this.localDoc = localDoc;
90333
- this._doc = this.localDoc.toJSON();
91102
+ this._doc = ((_b = (_a = this.localDoc).rawData) == null ? void 0 : _b.call(_a)) || this.localDoc.toJSON();
90334
91103
  }
90335
91104
  get doc() {
90336
91105
  return this._doc;
@@ -90385,6 +91154,17 @@ ${data2.plantumlText}
90385
91154
  this._doc.comments[id] = shareDBComment;
90386
91155
  Array.from(this._listeners.values()).forEach((listener) => listener.onUpdateComment(id, true));
90387
91156
  }
91157
+ localUpdateCommentResolver(commentId, resolver) {
91158
+ const comment = this.getComment(commentId);
91159
+ if (comment) {
91160
+ if (resolver) {
91161
+ comment.resolver = resolver;
91162
+ } else {
91163
+ delete comment.resolver;
91164
+ }
91165
+ Array.from(this._listeners.values()).forEach((listener) => listener.onUpdateCommentResolver(commentId, true));
91166
+ }
91167
+ }
90388
91168
  createCommentEditor(parent, childDoc) {
90389
91169
  const commentEditor = createCommentEditor(this.editor, {
90390
91170
  root: parent,
@@ -91123,8 +91903,8 @@ ${data2.plantumlText}
91123
91903
  const inlineStyles = attributesOfText(text2, "inlineStyle");
91124
91904
  if (inlineStyles == null)
91125
91905
  return;
91126
- const styles = inlineStyles.split(";");
91127
- for (const style2 of styles) {
91906
+ const styles2 = inlineStyles.split(";");
91907
+ for (const style2 of styles2) {
91128
91908
  const pair = style2.split(":");
91129
91909
  if (pair.length !== 2)
91130
91910
  continue;
@@ -92940,6 +93720,7 @@ ${data2.plantumlText}
92940
93720
  id: options.id,
92941
93721
  scrollContainer: options == null ? void 0 : options.scrollContainer,
92942
93722
  enableComments: options == null ? void 0 : options.enableComments,
93723
+ enableResolveComments: options == null ? void 0 : options.enableResolveComments,
92943
93724
  enableContextMenu: options == null ? void 0 : options.enableContextMenu,
92944
93725
  components: {
92945
93726
  blocks: [...StandardBlocks, ...((_d = options == null ? void 0 : options.components) == null ? void 0 : _d.blocks) || []],
@@ -93177,7 +93958,7 @@ ${data2.plantumlText}
93177
93958
  }
93178
93959
  }
93179
93960
  });
93180
- editor.version = "2.8.27";
93961
+ editor.version = "2.8.28-beta.2";
93181
93962
  return editor;
93182
93963
  }
93183
93964
  function isDoc(doc2) {
@@ -93199,6 +93980,7 @@ ${data2.plantumlText}
93199
93980
  const editor = createEditor(root2, doc2, {
93200
93981
  id: options.id,
93201
93982
  scrollContainer: options == null ? void 0 : options.scrollContainer,
93983
+ enableResolveComments: options == null ? void 0 : options.enableResolveComments,
93202
93984
  components: {
93203
93985
  blocks: [...StandardBlocks, ...(_f = (_e = options.components) == null ? void 0 : _e.blocks) != null ? _f : []],
93204
93986
  commandProviders: [new TableBlockCommandProvider()],
@@ -93290,7 +94072,7 @@ ${data2.plantumlText}
93290
94072
  }
93291
94073
  });
93292
94074
  OnesEditorToolbar.register(editor);
93293
- editor.version = "2.8.27";
94075
+ editor.version = "2.8.28-beta.2";
93294
94076
  return editor;
93295
94077
  }
93296
94078
  async function showDocVersions(editor, options, serverUrl) {
@@ -139110,6 +139892,7 @@ ${data2.plantumlText}
139110
139892
  exports2.CheckMarkIcon = CheckMarkIcon;
139111
139893
  exports2.CheckboxIcon = CheckboxIcon;
139112
139894
  exports2.CircleAddIcon = CircleAddIcon;
139895
+ exports2.CircleCheckMarkIcon = CircleCheckMarkIcon;
139113
139896
  exports2.ClearIcon = ClearIcon;
139114
139897
  exports2.ClipboardProvider = ClipboardProvider;
139115
139898
  exports2.CloseIcon = CloseIcon;
@@ -139260,6 +140043,8 @@ ${data2.plantumlText}
139260
140043
  exports2.MoreItem = MoreItem;
139261
140044
  exports2.NextIcon = NextIcon;
139262
140045
  exports2.OnesEditorAutoSuggest = OnesEditorAutoSuggest;
140046
+ exports2.OnesEditorComments = OnesEditorComments;
140047
+ exports2.OnesEditorCommentsRender = OnesEditorCommentsRender;
139263
140048
  exports2.OnesEditorCustomDataWrapper = OnesEditorCustomDataWrapper;
139264
140049
  exports2.OnesEditorExclusiveBlock = OnesEditorExclusiveBlock;
139265
140050
  exports2.OnesEditorHoveringBlock = OnesEditorHoveringBlock;