@ones-editor/editor 2.8.15-beta.1 → 2.8.15

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.
@@ -0,0 +1,2 @@
1
+ import { type BlockElement, type BreakTextBlockResult, type BreakTextOptions, type OnesEditor } from '../../@ones-editor/core';
2
+ export declare function editorAutoBreakTextBlock(editor: OnesEditor, block: BlockElement, offset: number, options?: BreakTextOptions): BreakTextBlockResult;
@@ -0,0 +1 @@
1
+ export * from './break-text-block';
package/dist/index.d.ts CHANGED
@@ -44,6 +44,7 @@ export * from '../@ones-editor/templates';
44
44
  export * from 'tiny-typed-emitter';
45
45
  export { ShareDBDocVersionsProvider, OnesEditorIcons, isLayoutBlock, LayoutQuickMenuItemFilter, CalloutQuickMenuItemFilter, MobileCommandHandler, PasteSpecialHandler };
46
46
  export type { FileBoxData, FileEmbedData } from '../@ones-editor/file';
47
+ export * from './helper';
47
48
  export { type DocListBlock } from '../@ones-editor/list-block';
48
49
  export declare function getDefaultOnesEditorOptions(options: CreateOnesEditorOptions): {
49
50
  id: string | undefined;
package/dist/index.js CHANGED
@@ -26677,15 +26677,20 @@ var __publicField = (obj, key, value) => {
26677
26677
  return deleteCount;
26678
26678
  }
26679
26679
  const logger$3I = getLogger("break-text-block");
26680
- function copyBlockAttributes(editor, block) {
26680
+ function copyBlockAttributes(editor, block, options) {
26681
26681
  const blockData = editor.getBlockData(block);
26682
26682
  const quoted = blockData.quoted;
26683
+ const ret = {};
26683
26684
  if (quoted) {
26684
- return {
26685
- quoted
26686
- };
26685
+ ret.quoted = quoted;
26687
26686
  }
26688
- return {};
26687
+ if (options == null ? void 0 : options.copyHeading) {
26688
+ const heading = blockData.heading;
26689
+ if (heading) {
26690
+ ret.heading = heading;
26691
+ }
26692
+ }
26693
+ return ret;
26689
26694
  }
26690
26695
  function editorBreakTextBlock(editor, block, offset, options) {
26691
26696
  assert(logger$3I, isTextKindBlock(editor, block), `block is not a text kind block: ${getBlockType(block)}`);
@@ -51661,16 +51666,22 @@ ${codeText}
51661
51666
  function breakListBlock(editor, block, offset, attributesBlock) {
51662
51667
  const fixStart = new FixStartByList(editor, attributesBlock);
51663
51668
  const start = getListBlockStart(attributesBlock) + 1;
51664
- editorBreakTextBlock(editor, block, offset, {
51669
+ const result = editorBreakTextBlock(editor, block, offset, {
51665
51670
  forceInsertAfter: true,
51666
51671
  newBlockData: cloneListData(editor, attributesBlock, {
51667
51672
  start
51668
51673
  })
51669
51674
  });
51670
51675
  fixStart.fix();
51676
+ return result;
51671
51677
  }
51672
- function handleEnter$1(editor) {
51678
+ function autoBreakListBlock(editor, block, offset) {
51673
51679
  var _a;
51680
+ const atBlockEnd = offset === getBlockTextLength$6(editor, block);
51681
+ const attributesBlock = (_a = atBlockEnd ? findCloneableList(block) : block) != null ? _a : block;
51682
+ return breakListBlock(editor, block, offset, attributesBlock);
51683
+ }
51684
+ function handleEnter$1(editor) {
51674
51685
  if (editor.selection.range.isCollapsed()) {
51675
51686
  const block2 = editor.selection.focusedBlock;
51676
51687
  if (isListBlock(block2)) {
@@ -51694,9 +51705,7 @@ ${codeText}
51694
51705
  return false;
51695
51706
  }
51696
51707
  const offset = focus.offset;
51697
- const atBlockEnd = offset === getBlockTextLength$6(editor, block);
51698
- const attributesBlock = (_a = atBlockEnd ? findCloneableList(block) : block) != null ? _a : block;
51699
- breakListBlock(editor, block, offset, attributesBlock);
51708
+ autoBreakListBlock(editor, block, offset);
51700
51709
  return true;
51701
51710
  }
51702
51711
  function findPrevBrotherAsParent(block) {
@@ -88286,21 +88295,27 @@ ${data2.plantumlText}
88286
88295
  };
88287
88296
  class FigmaAnalyzer {
88288
88297
  constructor() {
88289
- __publicField(this, "regex", /https:\/\/([\w.-]+\.)?figma.com\/design\/.*$/);
88298
+ __publicField(this, "regex", /https:\/\/([\w.-]+\.)?figma.com\/.*$/i);
88290
88299
  }
88291
88300
  analyze(url) {
88292
88301
  if (url.match(this.regex)) {
88293
88302
  const urlObj = new URL(url);
88294
88303
  const search = new URLSearchParams();
88304
+ let pathname = urlObj.pathname;
88305
+ pathname = pathname.replace(/^\/file\//i, "/design/");
88295
88306
  const nodeId = urlObj.searchParams.get("node-id");
88296
88307
  if (nodeId) {
88297
88308
  search.append("node-id", nodeId);
88298
88309
  }
88299
88310
  search.append("embed-host", "share");
88311
+ let targetURL = `https://embed.figma.com${pathname}?${search.toString()}`;
88312
+ if (!pathname.match(/^\/design\//i)) {
88313
+ targetURL = url;
88314
+ }
88300
88315
  return {
88301
88316
  type: "iframe",
88302
88317
  providerName: "figma",
88303
- url: `https://embed.figma.com${urlObj.pathname}?${search.toString()}`
88318
+ url: targetURL
88304
88319
  };
88305
88320
  }
88306
88321
  return null;
@@ -88513,7 +88528,8 @@ ${data2.plantumlText}
88513
88528
  return urlAnalyzer.analyze(url);
88514
88529
  }
88515
88530
  function formatValue(value) {
88516
- if (value && !value.startsWith("http://") && !value.startsWith("https://") && !value.startsWith("//")) {
88531
+ const regex = /^(https?:)?\/\//i;
88532
+ if (value && !value.match(regex)) {
88517
88533
  return `${window.location.protocol}//${value}`;
88518
88534
  }
88519
88535
  return value;
@@ -92528,6 +92544,12 @@ ${data2.plantumlText}
92528
92544
  this.toolbar.updateItems(items);
92529
92545
  }
92530
92546
  }
92547
+ function editorAutoBreakTextBlock(editor, block, offset, options) {
92548
+ if (isListBlock(block)) {
92549
+ return autoBreakListBlock(editor, block, offset);
92550
+ }
92551
+ return editorBreakTextBlock(editor, block, offset, options);
92552
+ }
92531
92553
  const logger = getLogger("create-editor");
92532
92554
  function getDefaultOnesEditorOptions(options) {
92533
92555
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
@@ -92775,7 +92797,7 @@ ${data2.plantumlText}
92775
92797
  }
92776
92798
  }
92777
92799
  });
92778
- editor.version = "2.8.15-beta.1";
92800
+ editor.version = "2.8.15";
92779
92801
  return editor;
92780
92802
  }
92781
92803
  function isDoc(doc2) {
@@ -92888,7 +92910,7 @@ ${data2.plantumlText}
92888
92910
  }
92889
92911
  });
92890
92912
  OnesEditorToolbar.register(editor);
92891
- editor.version = "2.8.15-beta.1";
92913
+ editor.version = "2.8.15";
92892
92914
  return editor;
92893
92915
  }
92894
92916
  async function showDocVersions(editor, options, serverUrl) {
@@ -139073,6 +139095,7 @@ ${data2.plantumlText}
139073
139095
  exports2.editLink = editLink;
139074
139096
  exports2.editorAddComment = editorAddComment;
139075
139097
  exports2.editorAddTextAttribute = editorAddTextAttribute;
139098
+ exports2.editorAutoBreakTextBlock = editorAutoBreakTextBlock;
139076
139099
  exports2.editorAutoInsertBlock = editorAutoInsertBlock;
139077
139100
  exports2.editorBreakTextBlock = editorBreakTextBlock;
139078
139101
  exports2.editorClearCompositionText = editorClearCompositionText;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.8.15-beta.1",
3
+ "version": "2.8.15",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {