Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix list IME support in Safari #3875

Merged
merged 3 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion assets/core.styl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ resets(arr)
li
list-style-type: none
padding-left: LIST_STYLE_OUTER_WIDTH
position: relative

> .ql-ui:before
display: inline-block
Expand Down Expand Up @@ -211,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)
Expand Down
23 changes: 23 additions & 0 deletions e2e/list.spec.ts
Original file line number Diff line number Diff line change
@@ -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 });
});
});
3 changes: 2 additions & 1 deletion e2e/utils/index.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
80 changes: 28 additions & 52 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down