Skip to content

Commit 8276daa

Browse files
authored
fix changelog (#2704)
1 parent 238c909 commit 8276daa

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/components/modules/blockEvents.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,13 @@ export default class BlockEvents extends Module {
249249
return;
250250
}
251251

252+
/**
253+
* The Toolbox will be opened with immediate focus on the Search input,
254+
* and '/' will be added in the search input by default — we need to prevent it and add '/' manually
255+
*/
256+
event.preventDefault();
257+
this.Editor.Caret.insertContentAtCaretPosition('/');
258+
252259
this.activateToolbox();
253260
}
254261

test/cypress/tests/modules/BlockEvents/Slash.cy.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
describe('Slash keydown', function () {
22
describe('pressed in empty block', function () {
3-
it('should open Toolbox', () => {
3+
it('should add "/" in a block and open Toolbox', () => {
44
cy.createEditor({
55
data: {
66
blocks: [
@@ -19,6 +19,14 @@ describe('Slash keydown', function () {
1919
.click()
2020
.type('/');
2121

22+
/**
23+
* Block content should contain slash
24+
*/
25+
cy.get('[data-cy=editorjs]')
26+
.find('.ce-paragraph')
27+
.invoke('text')
28+
.should('eq', '/');
29+
2230
cy.get('[data-cy="toolbox"] .ce-popover__container')
2331
.should('be.visible');
2432
});

0 commit comments

Comments
 (0)