Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blocksuite/virgo

Package Overview
Dependencies
Maintainers
5
Versions
509
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blocksuite/virgo - npm Package Compare versions

Comparing version 0.4.0-20230201063624-4e0463b to 0.4.0-20230201220903-262005c

24

dist/__tests__/input.spec.js

@@ -88,2 +88,26 @@ import { expect, test } from '@playwright/test';

});
test('readonly mode', async ({ page }) => {
await enterPlayground(page);
await focusRichText(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 pageType(page, 'abcdefg');
expect(await editorA.innerText()).toBe('abcdefg');
expect(await editorB.innerText()).toBe('abcdefg');
await page.evaluate(() => {
const richTextA = document
.querySelector('test-page')
?.shadowRoot?.querySelector('rich-text');
if (!richTextA) {
throw new Error('Cannot find editor');
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
richTextA.vEditor.setReadOnly(true);
});
await pageType(page, 'aaaa');
expect(await editorA.innerText()).toBe('abcdefg');
expect(await editorB.innerText()).toBe('abcdefg');
});
//# sourceMappingURL=input.spec.js.map

3

dist/virgo.d.ts

@@ -14,2 +14,3 @@ import type * as Y from 'yjs';

private _isComposing;
private _isReadOnly;
private _renderElement;

@@ -28,2 +29,4 @@ signals: {

getVRange(): VRange | null;
getReadOnly(): boolean;
setReadOnly(isReadOnly: boolean): void;
setVRange(vRange: VRange): void;

@@ -30,0 +33,0 @@ deleteText(vRange: VRange): void;

@@ -12,2 +12,3 @@ import { ZERO_WIDTH_SPACE } from './constant.js';

this._isComposing = false;
this._isReadOnly = false;
this._renderElement = baseRenderElement;

@@ -146,2 +147,8 @@ this._onYTextChange = () => {

}
getReadOnly() {
return this._isReadOnly;
}
setReadOnly(isReadOnly) {
this._isReadOnly = isReadOnly;
}
setVRange(vRange) {

@@ -380,2 +387,5 @@ this.signals.updateVRange.emit([vRange, 'other']);

event.preventDefault();
if (this._isReadOnly) {
return;
}
if (!this._vRange) {

@@ -382,0 +392,0 @@ return;

4

package.json
{
"name": "@blocksuite/virgo",
"version": "0.4.0-20230201063624-4e0463b",
"version": "0.4.0-20230201220903-262005c",
"description": "A micro editor.",

@@ -26,3 +26,3 @@ "main": "dist/index.js",

"dependencies": {
"@blocksuite/global": "0.4.0-20230201063624-4e0463b"
"@blocksuite/global": "0.4.0-20230201220903-262005c"
},

@@ -29,0 +29,0 @@ "scripts": {

@@ -133,1 +133,35 @@ import { expect, test } from '@playwright/test';

});
test('readonly mode', async ({ page }) => {
await enterPlayground(page);
await focusRichText(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 pageType(page, 'abcdefg');
expect(await editorA.innerText()).toBe('abcdefg');
expect(await editorB.innerText()).toBe('abcdefg');
await page.evaluate(() => {
const richTextA = document
.querySelector('test-page')
?.shadowRoot?.querySelector('rich-text');
if (!richTextA) {
throw new Error('Cannot find editor');
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(richTextA as any).vEditor.setReadOnly(true);
});
await pageType(page, 'aaaa');
expect(await editorA.innerText()).toBe('abcdefg');
expect(await editorB.innerText()).toBe('abcdefg');
});

@@ -30,2 +30,3 @@ import type * as Y from 'yjs';

private _isComposing = false;
private _isReadOnly = false;
private _renderElement: (delta: DeltaInsert) => TextElement =

@@ -157,2 +158,10 @@ baseRenderElement;

getReadOnly(): boolean {
return this._isReadOnly;
}
setReadOnly(isReadOnly: boolean): void {
this._isReadOnly = isReadOnly;
}
setVRange(vRange: VRange): void {

@@ -472,2 +481,6 @@ this.signals.updateVRange.emit([vRange, 'other']);

if (this._isReadOnly) {
return;
}
if (!this._vRange) {

@@ -474,0 +487,0 @@ return;

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc