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