Skip to content

Commit

Permalink
conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
ivailop7 committed Mar 27, 2023
1 parent 4ca696b commit ffb7f4e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 23 deletions.
33 changes: 17 additions & 16 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
"test-e2e-collab-ci-webkit": "npm run prepare-ci && cross-env E2E_PORT=4000 concurrently -k -s \"first\" \"npm run collab\" \"npm run test-e2e-collab-webkit\"",
"test-e2e-prod-ci-chromium": "npm run prepare-ci-prod && cross-env E2E_PORT=4000 npm run test-e2e-prod-chromium",
"test-e2e-collab-prod-ci-chromium": " npm run prepare-ci-prod && cross-env E2E_PORT=4000 concurrently -k -s \"first\" \"npm run collab\" \"npm run test-e2e-collab-prod-chromium\"",
"run-all": "npm-run-all debug-test-e2e-*",
"debug-run-all": "npm-run-all debug-test-e2e-*",
"run-all": "npm-run-all test-e2e-*",
"debug-test-e2e": "cross-env playwright test --debug",
"debug-test-e2e-chromium": "cross-env E2E_BROWSER=chromium playwright test --debug --project=\"chromium\"",
"debug-test-e2e-prod-chromium": "cross-env E2E_BROWSER=chromium E2E_PORT=4173 playwright test --debug --project=\"chromium\"",
Expand Down Expand Up @@ -103,7 +104,6 @@
"@babel/preset-flow": "^7.14.5",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.16.7",
"@excalidraw/excalidraw": "^0.14.2",
"@playwright/test": "^1.28.1",
"@rollup/plugin-alias": "^3.1.4",
"@rollup/plugin-babel": "^5.3.0",
Expand Down
15 changes: 10 additions & 5 deletions packages/lexical-playground/src/plugins/ToolbarPlugin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -551,14 +551,19 @@ export default function ToolbarPlugin(): JSX.Element {
// So that we don't format unselected text inside those nodes
if ($isTextNode(node)) {
if (idx === 0 && anchor.offset !== 0) {
node = node.splitText(anchor.offset)[1];
node = node.splitText(anchor.offset)[1] || node;
}
if (idx === nodes.length - 1) {
node = node.splitText(focus.offset)[0];
node = node.splitText(focus.offset)[0] || node;
}

if (node.__style !== '') {
node.setStyle('');
}
if (node.__format !== 0) {
node.setFormat(0);
$getNearestBlockElementAncestorOrThrow(node).setFormat('');
}
node.setFormat(0);
node.setStyle('');
$getNearestBlockElementAncestorOrThrow(node).setFormat('');
} else if ($isHeadingNode(node) || $isQuoteNode(node)) {
node.replace($createParagraphNode(), true);
} else if ($isDecoratorBlockNode(node)) {
Expand Down

0 comments on commit ffb7f4e

Please sign in to comment.