mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
refactor(editor): merge inline to std (#11025)
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
||||
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
|
||||
"@blocksuite/global": "workspace:*",
|
||||
"@blocksuite/inline": "workspace:*",
|
||||
"@blocksuite/store": "workspace:*",
|
||||
"@lit/context": "^1.1.2",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
@@ -39,7 +38,8 @@
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./gfx": "./src/gfx/index.ts",
|
||||
"./effects": "./src/effects.ts"
|
||||
"./effects": "./src/effects.ts",
|
||||
"./inline": "./src/inline/index.ts"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
|
||||
@@ -3,7 +3,7 @@ import { expect, test } from 'vitest';
|
||||
import {
|
||||
deltaInsertsToChunks,
|
||||
transformDelta,
|
||||
} from '../utils/delta-convert.js';
|
||||
} from '../../inline/utils/delta-convert.js';
|
||||
|
||||
test('transformDelta', () => {
|
||||
expect(
|
||||
@@ -1,7 +1,7 @@
|
||||
import { expect, test } from 'vitest';
|
||||
import * as Y from 'yjs';
|
||||
|
||||
import { InlineEditor } from '../inline-editor.js';
|
||||
import { InlineEditor } from '../../inline/index.js';
|
||||
|
||||
test('getDeltaByRangeIndex', () => {
|
||||
const yDoc = new Y.Doc();
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
isInlineRangeIntersect,
|
||||
isPoint,
|
||||
mergeInlineRange,
|
||||
} from '../utils/inline-range.js';
|
||||
} from '../../inline/utils/inline-range.js';
|
||||
|
||||
test('isInlineRangeContain', () => {
|
||||
expect(
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { DeltaInsert } from '@blocksuite/store';
|
||||
import { expect, type Page } from '@playwright/test';
|
||||
|
||||
import type { InlineEditor, InlineRange } from '../index.js';
|
||||
import type { InlineEditor, InlineRange } from '../../inline/index.js';
|
||||
|
||||
const defaultPlaygroundURL = new URL(
|
||||
`http://localhost:${process.env.CI ? 4173 : 5173}/`
|
||||
@@ -1,7 +1,14 @@
|
||||
import { GfxViewportElement } from './gfx/viewport-element.js';
|
||||
import { VElement, VLine, VText } from './inline/index.js';
|
||||
import { EditorHost } from './view/index.js';
|
||||
|
||||
export function effects() {
|
||||
// editor host
|
||||
customElements.define('editor-host', EditorHost);
|
||||
// gfx
|
||||
customElements.define('gfx-viewport', GfxViewportElement);
|
||||
// inline
|
||||
customElements.define('v-element', VElement);
|
||||
customElements.define('v-line', VLine);
|
||||
customElements.define('v-text', VText);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ export * from './command/index.js';
|
||||
export * from './event/index.js';
|
||||
export * from './extension/index.js';
|
||||
export * from './identifier.js';
|
||||
export * from './inline/index.js';
|
||||
export * from './scope/index.js';
|
||||
export * from './selection/index.js';
|
||||
export * from './spec/index.js';
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
export * from './components';
|
||||
export * from './consts';
|
||||
export * from './inline-editor';
|
||||
export * from './range';
|
||||
export * from './services';
|
||||
export * from './types';
|
||||
export * from './utils';
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import type { InlineRange, InlineRangeProvider } from '@blocksuite/inline';
|
||||
import type {
|
||||
InlineRange,
|
||||
InlineRangeProvider,
|
||||
} from '@blocksuite/block-std/inline';
|
||||
import { signal } from '@preact/signals-core';
|
||||
|
||||
import { TextSelection } from '../../selection/index.js';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { INLINE_ROOT_ATTR, type InlineRootElement } from '@blocksuite/inline';
|
||||
|
||||
import { LifeCycleWatcher } from '../../extension/index.js';
|
||||
import { TextSelection } from '../../selection/index.js';
|
||||
import type { BlockComponent } from '../../view/element/block-component.js';
|
||||
import { BLOCK_ID_ATTR } from '../../view/index.js';
|
||||
import { INLINE_ROOT_ATTR } from '../consts.js';
|
||||
import type { InlineRootElement } from '../inline-editor.js';
|
||||
import { RANGE_QUERY_EXCLUDE_ATTR, RANGE_SYNC_EXCLUDE_ATTR } from './consts.js';
|
||||
import { RangeBinding } from './range-binding.js';
|
||||
|
||||
|
||||
@@ -6,9 +6,5 @@
|
||||
"tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
|
||||
},
|
||||
"include": ["./src"],
|
||||
"references": [
|
||||
{ "path": "../global" },
|
||||
{ "path": "../inline" },
|
||||
{ "path": "../store" }
|
||||
]
|
||||
"references": [{ "path": "../global" }, { "path": "../store" }]
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# `@blocksuite/inline`
|
||||
|
||||
Inline rich text editing component for BlockSuite. Checkout the docs at [blocksuite.io/inline](https://blocksuite.io/guide/inline.html).
|
||||
@@ -1,37 +0,0 @@
|
||||
{
|
||||
"name": "@blocksuite/inline",
|
||||
"description": "A micro editor.",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "tsc"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"keywords": [],
|
||||
"files": [
|
||||
"src",
|
||||
"dist",
|
||||
"!src/__tests__",
|
||||
"!dist/__tests__"
|
||||
],
|
||||
"author": "toeverything",
|
||||
"license": "MIT",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./consts": "./src/consts.ts",
|
||||
"./effects": "./src/effects.ts",
|
||||
"./types": "./src/types.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@blocksuite/global": "workspace:*",
|
||||
"@blocksuite/store": "workspace:*",
|
||||
"@preact/signals-core": "^1.8.0",
|
||||
"lit": "^3.2.0",
|
||||
"rxjs": "^7.8.1",
|
||||
"yjs": "^13.6.21",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vitest": "3.0.8"
|
||||
},
|
||||
"version": "0.20.0"
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { VElement, VLine, VText } from './components/index.js';
|
||||
|
||||
export function effects() {
|
||||
customElements.define('v-element', VElement);
|
||||
customElements.define('v-line', VLine);
|
||||
customElements.define('v-text', VText);
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
export * from './components/index.js';
|
||||
export * from './consts.js';
|
||||
export * from './inline-editor.js';
|
||||
export * from './services/index.js';
|
||||
export * from './types.js';
|
||||
export * from './utils/index.js';
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist",
|
||||
"tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
|
||||
},
|
||||
"include": ["./src"],
|
||||
"references": [{ "path": "../global" }, { "path": "../store" }]
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
export default defineConfig({
|
||||
esbuild: {
|
||||
target: 'es2018',
|
||||
},
|
||||
test: {
|
||||
include: ['src/__tests__/**/*.unit.spec.ts'],
|
||||
testTimeout: 500,
|
||||
coverage: {
|
||||
provider: 'istanbul', // or 'c8'
|
||||
reporter: ['lcov'],
|
||||
reportsDirectory: '../../../.coverage/inline',
|
||||
},
|
||||
/**
|
||||
* Custom handler for console.log in tests.
|
||||
*
|
||||
* Return `false` to ignore the log.
|
||||
*/
|
||||
onConsoleLog(log, type) {
|
||||
if (log.includes('https://lit.dev/msg/dev-mode')) {
|
||||
return false;
|
||||
}
|
||||
console.warn(`Unexpected ${type} log`, log);
|
||||
throw new Error(log);
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user