From 499b6233b6825ac0b6e69fa3b52b20570a871310 Mon Sep 17 00:00:00 2001 From: Zihua Li Date: Fri, 22 Sep 2023 11:52:08 +0800 Subject: [PATCH 1/3] Fix list IME support in Safari --- assets/core.styl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/core.styl b/assets/core.styl index c9f7dc9a0a..1182f18cb7 100644 --- a/assets/core.styl +++ b/assets/core.styl @@ -71,7 +71,9 @@ resets(arr) li list-style-type: none padding-left: LIST_STYLE_OUTER_WIDTH - position: relative + + > .ql-ui + position: static; > .ql-ui:before display: inline-block From 32f1ce3652dcb689a5fd8d7af01c92964606754c Mon Sep 17 00:00:00 2001 From: Zihua Li Date: Fri, 22 Sep 2023 12:30:41 +0800 Subject: [PATCH 2/3] Add tests for navigating with arrow keys --- e2e/list.spec.ts | 23 +++++++++++++ e2e/utils/index.ts | 3 +- package-lock.json | 80 ++++++++++++++++------------------------------ package.json | 3 +- 4 files changed, 54 insertions(+), 55 deletions(-) create mode 100644 e2e/list.spec.ts diff --git a/e2e/list.spec.ts b/e2e/list.spec.ts new file mode 100644 index 0000000000..a791f5ba6c --- /dev/null +++ b/e2e/list.spec.ts @@ -0,0 +1,23 @@ +import { expect } from '@playwright/test'; +import { test } from './fixtures'; +import { isMac } from './utils'; + +test.describe('list', () => { + test.beforeEach(async ({ editorPage }) => { + await editorPage.open(); + }); + + test('navigating with shortcuts', async ({ page, editorPage }) => { + await editorPage.setContents([ + { insert: 'item 1' }, + { insert: '\n', attributes: { list: 'bullet' } }, + ]); + + await editorPage.moveCursorAfterText('item 1'); + await page.keyboard.press(isMac ? `Meta+ArrowLeft` : 'Home'); + expect(await editorPage.getSelection()).toEqual({ index: 0, length: 0 }); + + await page.keyboard.press(isMac ? `Meta+ArrowRight` : 'End'); + expect(await editorPage.getSelection()).toEqual({ index: 6, length: 0 }); + }); +}); diff --git a/e2e/utils/index.ts b/e2e/utils/index.ts index 2f4627e7ce..dc2eb0f3b0 100644 --- a/e2e/utils/index.ts +++ b/e2e/utils/index.ts @@ -1,4 +1,5 @@ -export const SHORTKEY = process.platform === 'darwin' ? 'Meta' : 'Control'; +export const isMac = process.platform === 'darwin'; +export const SHORTKEY = isMac ? 'Meta' : 'Control'; export function getSelectionInTextNode() { const selection = document.getSelection(); diff --git a/package-lock.json b/package-lock.json index 0837ec0afd..2d08cfa0b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "@babel/core": "^7.22.5", "@babel/preset-env": "^7.22.5", "@babel/preset-typescript": "^7.22.5", - "@playwright/test": "^1.34.3", + "@playwright/test": "^1.38.1", "@types/lodash.clonedeep": "^4.5.7", "@types/lodash.isequal": "^4.5.6", "@types/lodash.merge": "^4.6.7", @@ -47,7 +47,6 @@ "lodash": "^4.17.15", "mini-css-extract-plugin": "^2.7.6", "npm-run-all": "^4.1.5", - "playwright": "^1.36.0", "prettier": "^3.0.1", "style-loader": "^3.3.3", "stylus": "^0.59.0", @@ -4247,22 +4246,18 @@ "dev": true }, "node_modules/@playwright/test": { - "version": "1.34.3", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.34.3.tgz", - "integrity": "sha512-zPLef6w9P6T/iT6XDYG3mvGOqOyb6eHaV9XtkunYs0+OzxBtrPAAaHotc0X+PJ00WPPnLfFBTl7mf45Mn8DBmw==", + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.38.1.tgz", + "integrity": "sha512-NqRp8XMwj3AK+zKLbZShl0r/9wKgzqI/527bkptKXomtuo+dOjU9NdMASQ8DNC9z9zLOMbG53T4eihYr3XR+BQ==", "dev": true, "dependencies": { - "@types/node": "*", - "playwright-core": "1.34.3" + "playwright": "1.38.1" }, "bin": { "playwright": "cli.js" }, "engines": { - "node": ">=14" - }, - "optionalDependencies": { - "fsevents": "2.3.2" + "node": ">=16" } }, "node_modules/@pmmmwh/react-refresh-webpack-plugin": { @@ -19222,37 +19217,27 @@ "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, "node_modules/playwright": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.36.0.tgz", - "integrity": "sha512-ODVOTp5WoRMxDJY3liMmC+wVNicc0cQB17gASvQ+zLBggVK9a2x3gdT5mbl7av+zomvtdirWOqqfD+O6qIrFgw==", + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.38.1.tgz", + "integrity": "sha512-oRMSJmZrOu1FP5iu3UrCx8JEFRIMxLDM0c/3o4bpzU5Tz97BypefWf7TuTNPWeCe279TPal5RtPPZ+9lW/Qkow==", "dev": true, - "hasInstallScript": true, "dependencies": { - "playwright-core": "1.36.0" + "playwright-core": "1.38.1" }, "bin": { "playwright": "cli.js" }, "engines": { "node": ">=16" - } - }, - "node_modules/playwright-core": { - "version": "1.34.3", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.34.3.tgz", - "integrity": "sha512-2pWd6G7OHKemc5x1r1rp8aQcpvDh7goMBZlJv6Co5vCNLVcQJdhxRL09SGaY6HcyHH9aT4tiynZabMofVasBYw==", - "dev": true, - "bin": { - "playwright-core": "cli.js" }, - "engines": { - "node": ">=14" + "optionalDependencies": { + "fsevents": "2.3.2" } }, - "node_modules/playwright/node_modules/playwright-core": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.36.0.tgz", - "integrity": "sha512-7RTr8P6YJPAqB+8j5ATGHqD6LvLLM39sYVNsslh78g8QeLcBs5750c6+msjrHUwwGt+kEbczBj1XB22WMwn+WA==", + "node_modules/playwright-core": { + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.38.1.tgz", + "integrity": "sha512-tQqNFUKa3OfMf4b2jQ7aGLB8o9bS3bOY0yMEtldtC2+spf8QXG9zvXLTXUeRsoNuxEYMgLYR+NXfAa1rjKRcrg==", "dev": true, "bin": { "playwright-core": "cli.js" @@ -28443,14 +28428,12 @@ } }, "@playwright/test": { - "version": "1.34.3", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.34.3.tgz", - "integrity": "sha512-zPLef6w9P6T/iT6XDYG3mvGOqOyb6eHaV9XtkunYs0+OzxBtrPAAaHotc0X+PJ00WPPnLfFBTl7mf45Mn8DBmw==", + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.38.1.tgz", + "integrity": "sha512-NqRp8XMwj3AK+zKLbZShl0r/9wKgzqI/527bkptKXomtuo+dOjU9NdMASQ8DNC9z9zLOMbG53T4eihYr3XR+BQ==", "dev": true, "requires": { - "@types/node": "*", - "fsevents": "2.3.2", - "playwright-core": "1.34.3" + "playwright": "1.38.1" } }, "@pmmmwh/react-refresh-webpack-plugin": { @@ -39381,26 +39364,19 @@ "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, "playwright": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.36.0.tgz", - "integrity": "sha512-ODVOTp5WoRMxDJY3liMmC+wVNicc0cQB17gASvQ+zLBggVK9a2x3gdT5mbl7av+zomvtdirWOqqfD+O6qIrFgw==", + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.38.1.tgz", + "integrity": "sha512-oRMSJmZrOu1FP5iu3UrCx8JEFRIMxLDM0c/3o4bpzU5Tz97BypefWf7TuTNPWeCe279TPal5RtPPZ+9lW/Qkow==", "dev": true, "requires": { - "playwright-core": "1.36.0" - }, - "dependencies": { - "playwright-core": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.36.0.tgz", - "integrity": "sha512-7RTr8P6YJPAqB+8j5ATGHqD6LvLLM39sYVNsslh78g8QeLcBs5750c6+msjrHUwwGt+kEbczBj1XB22WMwn+WA==", - "dev": true - } + "fsevents": "2.3.2", + "playwright-core": "1.38.1" } }, "playwright-core": { - "version": "1.34.3", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.34.3.tgz", - "integrity": "sha512-2pWd6G7OHKemc5x1r1rp8aQcpvDh7goMBZlJv6Co5vCNLVcQJdhxRL09SGaY6HcyHH9aT4tiynZabMofVasBYw==", + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.38.1.tgz", + "integrity": "sha512-tQqNFUKa3OfMf4b2jQ7aGLB8o9bS3bOY0yMEtldtC2+spf8QXG9zvXLTXUeRsoNuxEYMgLYR+NXfAa1rjKRcrg==", "dev": true }, "postcss": { diff --git a/package.json b/package.json index bc0b8bc8ef..432849d681 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@babel/core": "^7.22.5", "@babel/preset-env": "^7.22.5", "@babel/preset-typescript": "^7.22.5", - "@playwright/test": "^1.34.3", + "@playwright/test": "^1.38.1", "@types/lodash.clonedeep": "^4.5.7", "@types/lodash.isequal": "^4.5.6", "@types/lodash.merge": "^4.6.7", @@ -51,7 +51,6 @@ "lodash": "^4.17.15", "mini-css-extract-plugin": "^2.7.6", "npm-run-all": "^4.1.5", - "playwright": "^1.36.0", "prettier": "^3.0.1", "style-loader": "^3.3.3", "stylus": "^0.59.0", From f6056792ef13c809a389106f1b52e7fddb9c4eab Mon Sep 17 00:00:00 2001 From: Zihua Li Date: Sat, 30 Sep 2023 08:46:41 +0800 Subject: [PATCH 3/3] Address feedbacks --- assets/core.styl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/assets/core.styl b/assets/core.styl index 1182f18cb7..b16de126e7 100644 --- a/assets/core.styl +++ b/assets/core.styl @@ -72,9 +72,6 @@ resets(arr) list-style-type: none padding-left: LIST_STYLE_OUTER_WIDTH - > .ql-ui - position: static; - > .ql-ui:before display: inline-block margin-left: -1*LIST_STYLE_OUTER_WIDTH @@ -213,6 +210,10 @@ resets(arr) .ql-ui position: absolute + li + > .ql-ui + position: static; + .ql-editor.ql-blank::before color: rgba(0,0,0,0.6) content: attr(data-placeholder)