@blocksuite/virgo
Advanced tools
Comparing version 0.4.0-20230212194855-047e1b9 to 0.4.0-20230213234455-1a23f69
@@ -9,3 +9,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
import { customElement, property } from 'lit/decorators.js'; | ||
import { styleMap } from 'lit/directives/style-map.js'; | ||
import { ZERO_WIDTH_SPACE } from '../constant.js'; | ||
const unitTextStyles = styleMap({ | ||
whiteSpace: 'pre', | ||
}); | ||
let VirgoUnitText = class VirgoUnitText extends LitElement { | ||
@@ -19,3 +23,5 @@ constructor() { | ||
// cause the sync problem about the cursor position | ||
return html `<span data-virgo-text="true">${this.str}</span>`; | ||
return html `<span style=${unitTextStyles} data-virgo-text="true" | ||
>${this.str}</span | ||
>`; | ||
} | ||
@@ -22,0 +28,0 @@ createRenderRoot() { |
@@ -496,2 +496,21 @@ import { expect, test } from '@playwright/test'; | ||
}); | ||
test('input continuous spaces', async ({ page }) => { | ||
await enterVirgoPlayground(page); | ||
await focusVirgoRichText(page); | ||
const editorA = page.locator('[data-virgo-root="true"]').nth(0); | ||
const editorB = page.locator('[data-virgo-root="true"]').nth(1); | ||
expect(await editorA.innerText()).toBe(ZERO_WIDTH_SPACE); | ||
expect(await editorB.innerText()).toBe(ZERO_WIDTH_SPACE); | ||
await type(page, 'abc def'); | ||
expect(await editorA.innerText()).toBe('abc def'); | ||
expect(await editorB.innerText()).toBe('abc def'); | ||
await focusVirgoRichText(page); | ||
await page.keyboard.press('ArrowLeft'); | ||
await page.keyboard.press('ArrowLeft'); | ||
await page.keyboard.press('ArrowLeft'); | ||
await page.keyboard.press('ArrowLeft'); | ||
await page.keyboard.press('Enter'); | ||
expect(await editorA.innerText()).toBe('abc \n' + ' def'); | ||
expect(await editorB.innerText()).toBe('abc \n' + ' def'); | ||
}); | ||
//# sourceMappingURL=virgo.spec.js.map |
{ | ||
"name": "@blocksuite/virgo", | ||
"version": "0.4.0-20230212194855-047e1b9", | ||
"version": "0.4.0-20230213234455-1a23f69", | ||
"description": "A micro editor.", | ||
@@ -26,3 +26,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@blocksuite/global": "0.4.0-20230212194855-047e1b9", | ||
"@blocksuite/global": "0.4.0-20230213234455-1a23f69", | ||
"zod": "^3.20.2" | ||
@@ -29,0 +29,0 @@ }, |
import { html, LitElement } from 'lit'; | ||
import { customElement, property } from 'lit/decorators.js'; | ||
import { styleMap } from 'lit/directives/style-map.js'; | ||
import { ZERO_WIDTH_SPACE } from '../constant.js'; | ||
const unitTextStyles = styleMap({ | ||
whiteSpace: 'pre', | ||
}); | ||
@customElement('virgo-unit-text') | ||
@@ -14,3 +19,5 @@ export class VirgoUnitText extends LitElement { | ||
// cause the sync problem about the cursor position | ||
return html`<span data-virgo-text="true">${this.str}</span>`; | ||
return html`<span style=${unitTextStyles} data-virgo-text="true" | ||
>${this.str}</span | ||
>`; | ||
} | ||
@@ -17,0 +24,0 @@ |
@@ -591,1 +591,28 @@ import { expect, test } from '@playwright/test'; | ||
}); | ||
test('input continuous spaces', async ({ page }) => { | ||
await enterVirgoPlayground(page); | ||
await focusVirgoRichText(page); | ||
const editorA = page.locator('[data-virgo-root="true"]').nth(0); | ||
const editorB = page.locator('[data-virgo-root="true"]').nth(1); | ||
expect(await editorA.innerText()).toBe(ZERO_WIDTH_SPACE); | ||
expect(await editorB.innerText()).toBe(ZERO_WIDTH_SPACE); | ||
await type(page, 'abc def'); | ||
expect(await editorA.innerText()).toBe('abc def'); | ||
expect(await editorB.innerText()).toBe('abc def'); | ||
await focusVirgoRichText(page); | ||
await page.keyboard.press('ArrowLeft'); | ||
await page.keyboard.press('ArrowLeft'); | ||
await page.keyboard.press('ArrowLeft'); | ||
await page.keyboard.press('ArrowLeft'); | ||
await page.keyboard.press('Enter'); | ||
expect(await editorA.innerText()).toBe('abc \n' + ' def'); | ||
expect(await editorB.innerText()).toBe('abc \n' + ' def'); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
236928
3377
+ Added@blocksuite/global@0.4.0-20230213234455-1a23f69(transitive)
- Removed@blocksuite/global@0.4.0-20230212194855-047e1b9(transitive)