Skip to content

Commit

Permalink
Merge branch 'next' into bug_fix_for_overiding_back_slash_character
Browse files Browse the repository at this point in the history
  • Loading branch information
neSpecc authored Dec 21, 2024
2 parents e26994e + 2ec88da commit 12bf75d
Show file tree
Hide file tree
Showing 25 changed files with 90 additions and 40 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/bump-version-on-merge-next.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Bump version on merge

# Caution:
# Caution:
# the use of "pull_request_target" trigger allows to successfully
# run workflow even when triggered from a fork. The trigger grants
# access to repo's secrets and gives write permission to the runner.
Expand All @@ -17,7 +17,7 @@ jobs:
# If pull request was merged then we should check for a package version update
check-for-no-version-changing:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
permissions:
actions: write
steps:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/create-a-release-draft.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Create a release draft

# Caution:
# Caution:
# the use of "pull_request_target" trigger allows to successfully
# run workflow even when triggered from a fork. The trigger grants
# access to repo's secrets and gives write permission to the runner.
Expand All @@ -17,7 +17,7 @@ jobs:
# If pull request was merged then we should check for a package version update
check-version-changing:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
permissions:
actions: write
steps:
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
asset_path: dist/editorjs.umd.js
asset_name: editorjs.umd.js
asset_content_type: application/javascript

# Build and upload target Editor.js MJS build to release as artifact
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
Expand All @@ -123,7 +123,7 @@ jobs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/editorjs.mjs
asset_name: editorjs.mjs
asset_content_type: application/javascript
asset_content_type: application/javascript

# Send a notification message
- name: Send a message
Expand All @@ -132,4 +132,4 @@ jobs:
webhook: ${{ secrets.CODEX_BOT_WEBHOOK_FRONTEND }}
message: '🦥 [Draft release v${{ steps.package.outputs.version }}](${{ steps.create_release.outputs.html_url }}) for package [${{ steps.package.outputs.name }}](${{ steps.package.outputs.npmjs-link }}) has been created. Add changelog and publish it!'
parse_mode: 'markdown'
disable_web_page_preview: true
disable_web_page_preview: true
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
matrix:
browser: [firefox, chrome, edge]

runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/setup-node@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [pull_request]
jobs:
lint:
name: ESlint
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-package-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
publish:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
# Checkout to target branch
- uses: actions/checkout@v4
Expand Down Expand Up @@ -62,4 +62,4 @@ jobs:
webhook: ${{ secrets.CODEX_BOT_NOTIFY_EDITORJS_PUBLIC_CHAT }}
message: '📦 [${{ steps.package.outputs.name }} ${{ steps.package.outputs.version }}](${{ env.GITHUB_LINK }}) was published'
parse_mode: 'markdown'
disable_web_page_preview: true
disable_web_page_preview: true
12 changes: 3 additions & 9 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
[submodule "example/tools/delimiter"]
path = example/tools/delimiter
url = https://github.com/editor-js/delimiter
[submodule "example/tools/list"]
path = example/tools/list
url = https://github.com/editor-js/list
[submodule "example/tools/quote"]
path = example/tools/quote
url = https://github.com/editor-js/quote
Expand All @@ -31,9 +28,6 @@
[submodule "example/tools/table"]
path = example/tools/table
url = https://github.com/editor-js/table
[submodule "example/tools/checklist"]
path = example/tools/checklist
url = https://github.com/editor-js/checklist
[submodule "example/tools/link"]
path = example/tools/link
url = https://github.com/editor-js/link
Expand All @@ -46,9 +40,9 @@
[submodule "example/tools/underline"]
path = example/tools/underline
url = https://github.com/editor-js/underline
[submodule "example/tools/nested-list"]
path = example/tools/nested-list
url = https://github.com/editor-js/nested-list
[submodule "example/tools/text-variant-tune"]
path = example/tools/text-variant-tune
url = https://github.com/editor-js/text-variant-tune
[submodule "example/tools/list"]
path = example/tools/list
url = https://github.com/editor-js/list
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### 2.31.0

- `New` - Inline tools (those with `isReadOnlySupported` specified) can now be used in read-only mode
- `New` - Inline tools (those with `isReadOnlySupported` specified) shortcuts now work in read-only mode
- `Improvement` - Block manager passes target tool config to the `conversionConfig.import` method on conversion
- `Fix` - Fix selection of first block in read-only initialization with "autofocus=true"
- `Fix` - Incorrect caret position after blocks merging in Safari
Expand Down
1 change: 0 additions & 1 deletion example/tools/checklist
Submodule checklist deleted from 1c116d
2 changes: 1 addition & 1 deletion example/tools/delimiter
Submodule delimiter updated 5 files
+10 −5 package.json
+40 −12 src/index.ts
+11 −0 tsconfig.json
+9 −2 vite.config.js
+926 −179 yarn.lock
2 changes: 1 addition & 1 deletion example/tools/embed
2 changes: 1 addition & 1 deletion example/tools/header
2 changes: 1 addition & 1 deletion example/tools/image
2 changes: 1 addition & 1 deletion example/tools/inline-code
2 changes: 1 addition & 1 deletion example/tools/list
Submodule list updated from a6dc6a to bbc46d
1 change: 0 additions & 1 deletion example/tools/nested-list
Submodule nested-list deleted from 591bd2
2 changes: 1 addition & 1 deletion example/tools/quote
Submodule quote updated 7 files
+24 −0 eslint.config.mjs
+18 −6 package.json
+0 −310 src/index.js
+408 −0 src/index.ts
+17 −0 tsconfig.json
+3 −2 vite.config.js
+2,470 −38 yarn.lock
2 changes: 1 addition & 1 deletion example/tools/raw
Submodule raw updated 2 files
+1 −1 package.json
+1 −1 src/index.js
2 changes: 1 addition & 1 deletion example/tools/table
2 changes: 1 addition & 1 deletion example/tools/warning
Submodule warning updated 7 files
+1 −0 .gitignore
+9 −4 package.json
+0 −191 src/index.js
+282 −0 src/index.ts
+18 −0 tsconfig.json
+3 −2 vite.config.js
+2,028 −198 yarn.lock
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@editorjs/editorjs",
"version": "2.31.0-rc.5",
"version": "2.31.0-rc.6",
"description": "Editor.js — open source block-style WYSIWYG editor with JSON output",
"main": "dist/editorjs.umd.js",
"module": "dist/editorjs.mjs",
Expand Down
5 changes: 4 additions & 1 deletion src/components/modules/toolbar/inline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,10 @@ export default class InlineToolbar extends Module<InlineToolbarNodes> {

this.popover?.activateItemByName(toolName);
},
on: this.Editor.UI.nodes.redactor,
/**
* We need to bind shortcut to the document to make it work in read-only mode
*/
on: document,
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/utils/shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface ShortcutData {
/**
* Element handler should be added for
*/
on: HTMLElement;
on: HTMLElement | Document;
}

/**
Expand Down
58 changes: 56 additions & 2 deletions test/cypress/tests/ui/InlineToolbar.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import Header from '@editorjs/header';
import type { MenuConfig } from '../../../../types/tools';
import type { InlineTool, MenuConfig } from '../../../../types/tools';
import { createEditorWithTextBlocks } from '../../support/utils/createEditorWithTextBlocks';

describe('Inline Toolbar', () => {
describe('Separators', () => {
Expand Down Expand Up @@ -174,4 +174,58 @@ describe('Inline Toolbar', () => {
.should('have.attr', 'data-item-name', 'test-tool');
});
});

describe('Shortcuts', () => {
it('should work in read-only mode', () => {
const toolSurround = cy.stub().as('toolSurround');

/* eslint-disable jsdoc/require-jsdoc */
class Marker implements InlineTool {
public static isInline = true;
public static shortcut = 'CMD+SHIFT+M';
public static isReadOnlySupported = true;
public render(): MenuConfig {
return {
icon: 'm',
title: 'Marker',
onActivate: () => {
toolSurround();
},
};
}
}
/* eslint-enable jsdoc/require-jsdoc */

createEditorWithTextBlocks([
'some text',
], {
tools: {
marker: Marker,
},
readOnly: true,
});

cy.get('[data-cy=editorjs]')
.find('.ce-paragraph')
.selectText('text');

cy.wait(300);

cy.document().then((doc) => {
doc.dispatchEvent(new KeyboardEvent('keydown', {
bubbles: true,
cancelable: true,
key: 'M',
code: 'KeyM',
keyCode: 77,
which: 77,
metaKey: true,
shiftKey: true,
}));
});

cy.get('@toolSurround').should('have.been.called');
});
});
});

4 changes: 2 additions & 2 deletions test/cypress/tests/utils/popover.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ describe('Popover', () => {
.should('exist');
});

it.only('shoould support i18n in nested popover', () => {
it('shoould support i18n in nested popover', () => {
/**
*
*/
Expand Down Expand Up @@ -1076,7 +1076,7 @@ describe('Popover', () => {
.should('exist');
});

it.only('should allow to reach nested popover via keyboard', () => {
it('should allow to reach nested popover via keyboard', () => {
cy.createEditor({
tools: {
header: {
Expand Down

0 comments on commit 12bf75d

Please sign in to comment.