mirror of
https://github.com/penpot/penpot.git
synced 2025-01-22 14:39:45 -05:00
🐛 Fix esm module incompatibilities on text-editor with node
This commit is contained in:
parent
04a0d867b0
commit
7faa9e970e
19 changed files with 52 additions and 52 deletions
|
@ -11,7 +11,7 @@ import commands from "./commands/index.js";
|
|||
import ChangeController from './controllers/ChangeController.js';
|
||||
import SelectionController from './controllers/SelectionController.js';
|
||||
import { createSelectionImposterFromClientRects } from './selection/Imposter.js';
|
||||
import { addEventListeners, removeEventListeners } from "./Event";
|
||||
import { addEventListeners, removeEventListeners } from "./Event.js";
|
||||
import { createRoot, createEmptyRoot } from './content/dom/Root.js';
|
||||
import { createParagraph, fixParagraph, getParagraph } from './content/dom/Paragraph.js';
|
||||
import { createEmptyInline, createInline } from './content/dom/Inline.js';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (c) KALEIDOS INC
|
||||
*/
|
||||
|
||||
import { mapContentFragmentFromHTML, mapContentFragmentFromString } from '~/editor/content/dom/Content';
|
||||
import { mapContentFragmentFromHTML, mapContentFragmentFromString } from '../content/dom/Content.js';
|
||||
|
||||
/**
|
||||
* When the user pastes some HTML, what we do is generate
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
* Copyright (c) KALEIDOS INC
|
||||
*/
|
||||
|
||||
import { createInline } from "./Inline";
|
||||
import { createInline } from "./Inline.js";
|
||||
import {
|
||||
createEmptyParagraph,
|
||||
createParagraph,
|
||||
isLikeParagraph,
|
||||
} from "./Paragraph";
|
||||
import { isDisplayBlock, normalizeStyles } from "./Style";
|
||||
} from "./Paragraph.js";
|
||||
import { isDisplayBlock, normalizeStyles } from "./Style.js";
|
||||
|
||||
/**
|
||||
* Maps any HTML into a valid content DOM element.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { describe, test, expect } from 'vitest';
|
||||
import { mapContentFragmentFromHTML, mapContentFragmentFromString } from './Content';
|
||||
import { mapContentFragmentFromHTML, mapContentFragmentFromString } from './Content.js';
|
||||
|
||||
/* @vitest-environment jsdom */
|
||||
describe('Content', () => {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (c) KALEIDOS INC
|
||||
*/
|
||||
|
||||
import { setStyles } from "./Style";
|
||||
import { setStyles } from "./Style.js";
|
||||
|
||||
/**
|
||||
* @typedef {Object} CreateElementOptions
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { describe, test, expect } from "vitest";
|
||||
import { createElement, isElement, createRandomId, isOffsetAtStart, isOffsetAtEnd } from "./Element";
|
||||
import { createElement, isElement, createRandomId, isOffsetAtStart, isOffsetAtEnd } from "./Element.js";
|
||||
|
||||
/* @vitest-environment jsdom */
|
||||
describe("Element", () => {
|
||||
|
|
|
@ -11,10 +11,10 @@ import {
|
|||
isElement,
|
||||
isOffsetAtStart,
|
||||
isOffsetAtEnd,
|
||||
} from "./Element";
|
||||
import { createLineBreak, isLineBreak } from "./LineBreak";
|
||||
import { setStyles, mergeStyles } from "./Style";
|
||||
import { createRandomId } from "./Element";
|
||||
} from "./Element.js";
|
||||
import { createLineBreak, isLineBreak } from "./LineBreak.js";
|
||||
import { setStyles, mergeStyles } from "./Style.js";
|
||||
import { createRandomId } from "./Element.js";
|
||||
|
||||
export const TAG = "SPAN";
|
||||
export const TYPE = "inline";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, test, expect } from "vitest";
|
||||
import { createEmptyInline, createInline, getInline, getInlineLength, isInline, isInlineEnd, isInlineStart, isLikeInline, splitInline, TAG, TYPE } from "./Inline";
|
||||
import { createLineBreak } from "./LineBreak";
|
||||
import { createEmptyInline, createInline, getInline, getInlineLength, isInline, isInlineEnd, isInlineStart, isLikeInline, splitInline, TAG, TYPE } from "./Inline.js";
|
||||
import { createLineBreak } from "./LineBreak.js";
|
||||
|
||||
/* @vitest-environment jsdom */
|
||||
describe("Inline", () => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { describe, expect, test } from 'vitest';
|
||||
import { createLineBreak } from './LineBreak';
|
||||
import { createLineBreak } from './LineBreak.js';
|
||||
|
||||
/* @vitest-environment jsdom */
|
||||
describe('LineBreak', () => {
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
isElement,
|
||||
isOffsetAtStart,
|
||||
isOffsetAtEnd,
|
||||
} from "./Element";
|
||||
} from "./Element.js";
|
||||
import {
|
||||
isInline,
|
||||
isLikeInline,
|
||||
|
@ -21,11 +21,11 @@ import {
|
|||
createEmptyInline,
|
||||
isInlineEnd,
|
||||
splitInline,
|
||||
} from "./Inline";
|
||||
import { createLineBreak, isLineBreak } from "./LineBreak";
|
||||
import { setStyles } from "./Style";
|
||||
import { createRandomId } from "./Element";
|
||||
import { isEmptyTextNode, isTextNode } from './TextNode';
|
||||
} from "./Inline.js";
|
||||
import { createLineBreak, isLineBreak } from "./LineBreak.js";
|
||||
import { setStyles } from "./Style.js";
|
||||
import { createRandomId } from "./Element.js";
|
||||
import { isEmptyTextNode, isTextNode } from './TextNode.js';
|
||||
|
||||
export const TAG = "DIV";
|
||||
export const TYPE = "paragraph";
|
||||
|
|
|
@ -12,8 +12,8 @@ import {
|
|||
splitParagraph,
|
||||
splitParagraphAtNode,
|
||||
isEmptyParagraph,
|
||||
} from "./Paragraph";
|
||||
import { createInline, isInline } from "./Inline";
|
||||
} from "./Paragraph.js";
|
||||
import { createInline, isInline } from "./Inline.js";
|
||||
|
||||
/* @vitest-environment jsdom */
|
||||
describe("Paragraph", () => {
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
* Copyright (c) KALEIDOS INC
|
||||
*/
|
||||
|
||||
import { createElement, isElement } from "./Element";
|
||||
import { createEmptyParagraph, isParagraph } from "./Paragraph";
|
||||
import { setStyles } from "./Style";
|
||||
import { createRandomId } from "./Element";
|
||||
import { createElement, isElement } from "./Element.js";
|
||||
import { createEmptyParagraph, isParagraph } from "./Paragraph.js";
|
||||
import { setStyles } from "./Style.js";
|
||||
import { createRandomId } from "./Element.js";
|
||||
|
||||
export const TAG = "DIV";
|
||||
export const TYPE = "root";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { describe, test, expect } from "vitest";
|
||||
import { createEmptyRoot, createRoot, setRootStyles, TAG, TYPE } from './Root'
|
||||
import { createEmptyRoot, createRoot, setRootStyles, TAG, TYPE } from './Root.js'
|
||||
|
||||
/* @vitest-environment jsdom */
|
||||
describe("Root", () => {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (c) KALEIDOS INC
|
||||
*/
|
||||
|
||||
import { getFills } from "./Color";
|
||||
import { getFills } from "./Color.js";
|
||||
|
||||
const DEFAULT_FONT_SIZE = "16px";
|
||||
const DEFAULT_LINE_HEIGHT = "1.2";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { describe, test, expect, vi } from "vitest";
|
||||
import { getStyles, isDisplayBlock, isDisplayInline, setStyle, setStyles } from "./Style";
|
||||
import { getStyles, isDisplayBlock, isDisplayInline, setStyle, setStyles } from "./Style.js";
|
||||
|
||||
/* @vitest-environment jsdom */
|
||||
describe("Style", () => {
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
* Copyright (c) KALEIDOS INC
|
||||
*/
|
||||
|
||||
import { isInline } from "./Inline";
|
||||
import { isLineBreak } from "./LineBreak";
|
||||
import { isParagraph } from "./Paragraph";
|
||||
import { isRoot } from "./Root";
|
||||
import { isInline } from "./Inline.js";
|
||||
import { isLineBreak } from "./LineBreak.js";
|
||||
import { isParagraph } from "./Paragraph.js";
|
||||
import { isRoot } from "./Root.js";
|
||||
|
||||
/**
|
||||
* Returns true if the node is "like"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { describe, test, expect } from 'vitest';
|
||||
import { isTextNode, getTextNodeLength } from './TextNode';
|
||||
import { createLineBreak } from './LineBreak';
|
||||
import { isTextNode, getTextNodeLength } from './TextNode.js';
|
||||
import { createLineBreak } from './LineBreak.js';
|
||||
|
||||
/* @vitest-environment jsdom */
|
||||
describe("TextNode", () => {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { describe, test, expect } from "vitest";
|
||||
import TextNodeIterator from "./TextNodeIterator";
|
||||
import { createInline } from "./Inline";
|
||||
import { createParagraph } from "./Paragraph";
|
||||
import { createRoot } from "./Root";
|
||||
import { createLineBreak } from "./LineBreak";
|
||||
import TextNodeIterator from "./TextNodeIterator.js";
|
||||
import { createInline } from "./Inline.js";
|
||||
import { createParagraph } from "./Paragraph.js";
|
||||
import { createRoot } from "./Root.js";
|
||||
import { createLineBreak } from "./LineBreak.js";
|
||||
|
||||
/* @vitest-environment jsdom */
|
||||
describe("TextNodeIterator", () => {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Copyright (c) KALEIDOS INC
|
||||
*/
|
||||
|
||||
import { createLineBreak, isLineBreak } from "~/editor/content/dom/LineBreak";
|
||||
import { createLineBreak, isLineBreak } from "../content/dom/LineBreak.js";
|
||||
import {
|
||||
createInline,
|
||||
createInlineFrom,
|
||||
|
@ -19,7 +19,7 @@ import {
|
|||
mergeInlines,
|
||||
splitInline,
|
||||
createEmptyInline,
|
||||
} from "~/editor/content/dom/Inline";
|
||||
} from "../content/dom/Inline.js";
|
||||
import {
|
||||
createEmptyParagraph,
|
||||
isEmptyParagraph,
|
||||
|
@ -32,21 +32,21 @@ import {
|
|||
splitParagraphAtNode,
|
||||
mergeParagraphs,
|
||||
fixParagraph,
|
||||
} from "~/editor/content/dom/Paragraph";
|
||||
} from "../content/dom/Paragraph.js";
|
||||
import {
|
||||
removeBackward,
|
||||
removeForward,
|
||||
replaceWith,
|
||||
insertInto,
|
||||
removeSlice,
|
||||
} from "~/editor/content/Text";
|
||||
import { getTextNodeLength, getClosestTextNode, isTextNode } from "~/editor/content/dom/TextNode";
|
||||
import TextNodeIterator from "~/editor/content/dom/TextNodeIterator";
|
||||
import TextEditor from "~/editor/TextEditor";
|
||||
import CommandMutations from "~/editor/commands/CommandMutations";
|
||||
import { setRootStyles } from "~/editor/content/dom/Root";
|
||||
import { SelectionDirection } from "./SelectionDirection";
|
||||
import SafeGuard from './SafeGuard';
|
||||
} from "../content/Text.js";
|
||||
import { getTextNodeLength, getClosestTextNode, isTextNode } from "../content/dom/TextNode.js";
|
||||
import TextNodeIterator from "../content/dom/TextNodeIterator.js";
|
||||
import TextEditor from "../TextEditor.js";
|
||||
import CommandMutations from "../commands/CommandMutations.js";
|
||||
import { setRootStyles } from "../content/dom/Root.js";
|
||||
import { SelectionDirection } from "./SelectionDirection.js";
|
||||
import SafeGuard from "./SafeGuard.js";
|
||||
|
||||
const SAFE_GUARD = true;
|
||||
const SAFE_GUARD_TIME = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue