Commit graph

93 commits

Author SHA1 Message Date
Peter
cd65d8cd29
imrovement(flipper): allow to select next/prev line by shift arrows (#2918)
* fix: prevent flipper navigation when shift key is pressed

* rm logs

* feat: improve line selection with Shift + Up/Down

* fix lint action

* fix action

* upd
2025-03-11 10:01:46 +03:00
Omotayo Obafemi
d950a11b8e
Bug Fix For When "/" Overides external text (#2894)
* Bug Fix For When / Overides external text

* Moved fix to blockEvents

* Moved fix to blockEvents

* Moved fix to blockEvents

* Refactored test to simulate behaviour

* Added fix to change log

* Refactored test to mimick exact behaviour of the bug

---------

Co-authored-by: Omotayo Obafemi <omotayo@testlio.com>
Co-authored-by: Peter <specc.dev@gmail.com>
2025-01-08 18:23:38 +03:00
Vineeth
444caa9870
fix: properly handle visible whitespaces in empty blocks (#2865)
* fix: handle whitespace input in empty placeholders correctly

* fix: isNodeEmpty() to handle visible whitespaces

* chore: bump version from 2.31.0-rc.5 to 2.31.0-rc.6

* chore: bump version from 2.31.0-rc.5 to 2.31.0-rc.6

* fix: submodules updated

* fix: eslint errors

* test: backspace removes trailing spaces, hides placeholder in empty blocks

* fix: update incorrect tests

* fix: resolving submodules issue

* Create list

---------

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
2024-12-21 19:40:15 +05:30
Peter
6893462d4b
fix(inline-tools): inline tools shortcuts now works in read-only mode (#2891)
* fix(inline-tools): inline tools shortcuts now works in read-only mode

* use ubuntu-20.04 instead of latest
2024-12-21 11:28:55 +03:00
Peter
7ee06228e7
chore(ui): update current block in readonly by clicks on block (#2859)
* chore(ui): update current block in readonly by clicks on block

* fix eslint
2024-11-06 20:54:51 +03:00
e11sy
da4257a67f
Feat (Conversion-config): pass target tool config to the conversionConfig.import method (#2848)
* pass config to the conversionConfig.import method

- Now `convertStringToBlockData` method passes target tool config the import method
- Fixed types in convesion config file (somehow imprort could return function that returns string, but import should return method that would return ToolData) this caused just type error that never been reached because types were actually ignored
- Added test that checks, that import method actualy gets passed config

* update changelog

* eslint fix

* updated test description

* jsdoc improved

* typos in changelog
2024-10-17 19:38:02 +03:00
e11sy
3cd24c4da1
Chore (toolbox): improved shortcuts visibility when tool exports array of toolbox items (#2846)
* toolbox items logic improved

* typo

* lint fix

* logic improved

* make displaySecondaryLabel true by default

* eslint fix

* added testcase

* updated changelog

* typo

* lint fix
2024-10-16 21:57:43 +03:00
Peter
eb7ffcba3c
fix(merge): after merge caret will be set in a place of glue (#2841)
* fix merge caret loosing

* changelog and patch

* Update nested-list

* Update Backspace.cy.ts

* Update Backspace.cy.ts

* fix tests

* fix tests
2024-10-09 21:28:04 +03:00
Peter
2275ddfc3a
feat(inline-toolbar): inline tools now can be used in the readonly mode (#2832)
* feat(inline-toolbar): inline tools now can be used in the readonly mode

* tests added

* docs improved
2024-10-08 11:38:22 +03:00
Ilya Gorenburg
b6ba44d610
fix: prevent inline toolbar from closing in nested instance of editor (#2780)
* fix: prevent inline toolbar from closing in nested instance of editor

* docs: updated changelog.md with fix description

* fix: fix import to use `type`

---------

Co-authored-by: Peter <specc.dev@gmail.com>
2024-09-14 01:12:46 +03:00
VolgaIgor
c82933616c
Fixed display of conversion menu for blocks without export rule (#2799)
* Fixed display of convert menu for blocks without export rule

According to the workflow script from the documentation:
https://editorjs.io/tools-api/#conversionconfig

* Update CHANGELOG.md

* some improvements and tests

---------

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
2024-09-14 00:39:19 +03:00
Peter
3d01be4a69
fix(types): tools export types added (#2802)
* fix types export

* lint

* changelog

* tests fixed

* fix tests imports

* lint tests

* upd submodule

* Update yarn.lock

* rename wrapper to factory

* Update package.json

* rename to adapters

* Update tools.d.ts

* BlockTool -> BlockToolAdapter etc

* Update nested-list

* Update collection.ts
2024-08-09 18:04:57 +03:00
Tatiana Fomina
057bf17a6f
Fix i18n in nested popover (#2779) 2024-07-11 22:25:36 +03:00
Tatiana Fomina
89e192a56d
fix(ConvertTo): i18n (#2776)
* Fix i18n for convert to

* Add tests

* Update changelog

---------

Co-authored-by: Peter <specc.dev@gmail.com>
2024-07-10 23:26:42 +03:00
Tatiana Fomina
b6674367a5
Fix form submit on bold inline tool click (#2775) 2024-07-10 23:13:37 +03:00
Peter
91959bba43
fix(on-change): onchange callback wont be fired in readonly (#2773)
* fix(on-change): onchange callback wont be fired in readonly

* do not rerender blocks on initial call
2024-07-10 19:16:36 +03:00
Thomas Brillion
44c29dd645
feat(blocks-api): blocks.update() now can update tunes as well as data (#2720)
* Update `tunes` data when new `tunes` data is provided

AFAIK, when you update block using `editor.blocks.update` method, only `data` attribute is merged and updated. I believe `tunes` data should be updated if provided.

* commit

* edit parameter type, move test

* restore package-lock and yarn lock

* update in api docs

* make data optional

* edit changelog

---------

Co-authored-by: Thomas <zawlintun@robust.best>
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
2024-07-06 20:27:47 +03:00
Peter Savchenko
9c1e2e59ba
feat(ui): placeholders updated (#2758)
* data-empty mark

* Update CHANGELOG.md

* lint

* tests added

* Update DataEmpty.cy.ts

* lint

* fix tests

* Update Placeholders.cy.ts

* upd paragraph

* rm redundant test

* lint fix

* disable test for firefox
2024-07-04 14:55:01 +03:00
Tatiana Fomina
c3c1651092
fix(inline-toolbar): remove white dot visible in dark theme (#2755)
* Fix white dot visible in dark theme

* Fix test

---------

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
2024-07-03 19:40:55 +03:00
Peter Savchenko
1c88d526de
chore(toolbar): improve aligning with headings (#2748)
* chore(toolbar): improve aligning with headings

* fix eslint

* Update index.ts

* stash

* toolbar aligning improved

* improve case 2.1

* close toolbar after conversion

* rm submodules change

* Update index.html

* improve util method

* Update index.ts
2024-07-01 21:10:17 +03:00
Tatiana Fomina
439658a912
feat(inline-tools): Inline tools rendered as popover (#2718) 2024-06-30 22:27:37 +03:00
Peter Savchenko
afa99a4a8e
fix(caret): trailing spaces handling (#2741)
* Imporove caret.isAtStart

* use selection to simplify caret at start/end check

* caret util and tests

* lint

* eslint fix

* fix tests

* patch version, changelog

* fix navigation out of delimiter

* arrow left tests

* left/right arrow tests

* chore: Fix typo in comment for block navigation

* lint fix

* resolve some ts errors in strict mode

* Revert "resolve some ts errors in strict mode"

This reverts commit 3252ac679f.

* ts errors fix

* rename utils
2024-06-28 21:20:53 +03:00
Peter Savchenko
29d68ecb47
fix(block-events): caret losing after backspace after nested list (#2723)
* feat: Fix caret loss after Backspace at the start of block when previous block is not convertible

* fix create shadow caret

* fix: remove unnecessary blank line in blockEvents.ts

* fix: pass event object to slashPressed method in blockEvents.ts

* fix eslint
2024-05-23 20:06:33 +03:00
Tatiana Fomina
f78972ee09
feat(popover): custom content becomes a popover item (#2707)
* Add custom item

* Remove customcontent parameter from popover

* Tests

* Cleanup

* Cleanup

* Lint

* Cleanup

* Rename custom to html, add enum with item types

* Fix tests

* Add order test

* Update jsdoc

* Update changelog

* Fix issue with html item not hiding on search

* Fix flipper issue

* Update changelog
2024-05-04 15:35:36 +00:00
Peter Savchenko
8276daa5ca
fix changelog (#2704) 2024-05-01 20:59:33 +03:00
Peter Savchenko
23858e0025
fix(conversion): restore caret after conversion though the Inline Toolbar and API (#2699)
* fix caret loosing after caret

* Refactor convert method to return Promise in Blocks API

* changelog upd

* Fix missing semicolon in blocks.cy.ts and BlockTunes.cy.ts

* add test for inline toolbar conversion

* Fix missing semicolon in InlineToolbar.cy.ts

* add test for toolbox shortcut

* api caret.setToBlock now can accept block api or index or id

* eslint fix

* Refactor test descriptions in caret.cy.ts

* rm tsconfig change

* lint

* lint

* Update CHANGELOG.md
2024-04-29 22:24:31 +03:00
Tatiana Fomina
7821e35302
feat(block tunes): Conversion Menu in Block Tunes (#2692)
* Support delimiter

* Rename types, move types to popover-item folder

* Fix ts errors

* Add tests

* Review fixes

* Review fixes 2

* Fix delimiter while search

* Fix flipper issue

* Fix block tunes types

* Fix types

* tmp

* Fixes

* Make search input emit event

* Fix types

* Rename delimiter to separator

* Update chengelog

* Add convert to to block tunes

* i18n

* Lint

* Fix tests

* Fix tests 2

* Tests

* Add caching

* Rename

* Fix for miltiple toolbox entries

* Update changelog

* Update changelog

* Fix popover test

* Fix flipper tests

* Fix popover tests

* Remove type: 'default'

* Create isSameBlockData util

* Add testcase
2024-04-27 16:57:52 +03:00
Tatiana Fomina
e1c70b4fb8
feat(popover): separator (#2690)
* Support delimiter

* Rename types, move types to popover-item folder

* Fix ts errors

* Add tests

* Review fixes

* Review fixes 2

* Fix delimiter while search

* Fix flipper issue

* Fix block tunes types

* Fix types

* Fixes

* Make search input emit event

* Fix types

* Rename delimiter to separator

* Update chengelog
2024-04-22 22:38:20 +03:00
Tatiana Fomina
5125f015dc
feat: nested popover (#2649)
* Move popover types to separate file

* tmp

* open top

* Fix bug with keyboard navigation

* Fix bug with scroll

* Fix mobile

* Add popover header class

* Display nested items on mobile

* Refactor history

* Fix positioning on desktop

* Fix tests

* Fix child popover indent left

* Fix ts errors in popover files

* Move files

* Rename cn to bem

* Clarify comments and rename method

* Refactor popover css classes

* Rename cls to css

* Split popover desktop and mobile classes

* Add ability to open popover to the left if not enough space to open to the right

* Add nested popover test

* Add popover test for mobile screens

* Fix tests

* Add union type for both popovers

* Add global window resize event

* Multiple fixes

* Move nodes initialization to constructor

* Rename handleShowingNestedItems to showNestedItems

* Replace WindowResize with EditorMobileLayoutToggled

* New doze of fixes

* Review fixes

* Fixes

* Fixes

* Make each nested popover decide itself if it should open top

* Update changelog

* Update changelog

* Update changelog
2024-04-13 17:34:26 +00:00
Peter Savchenko
1320b047a2
feat(merge): blocks of different types can be merged (#2671)
* feature: possibilities to merge blocks of different types

* fix: remove scope change

* feat: use convert config instead of defined property

* chore:: use built-in function for type check

* fix: remove console.log

* chore: remove styling added by mistakes

* test: add testing for different blocks types merging

* fix: remove unused import

* fix: remove type argument

* fix: use existing functions for data export

* chore: update changelog

* fix: re put await

* fix: remove unnecessary check

* fix: typo in test name

* fix: re-add condition for merge

* test: add caret position test

* fix caret issues, add sanitize

* make if-else statement more clear

* upgrade cypress

* Update cypress.yml

* upd cypress to 13

* make sanitize test simpler

* patch rc version

---------

Co-authored-by: GuillaumeOnepilot <guillaume@onepilot.co>
Co-authored-by: Guillaume Leon <97881811+GuillaumeOnepilot@users.noreply.github.com>
2024-04-01 12:29:47 +03:00
Peter Savchenko
ee6433201d
fix(block-tunes): enter keydown problems (#2650)
* debug enter press

* fix sync set caret

* fix enter keydown problems + tests addedd

* Update search-input.ts

* add changelog

* add useful log to cypress custom comand

* Update commands.ts
2024-03-13 17:30:16 +03:00
VikhorKonstantin
8138ce95b2
fix issue #2523 (#2639)
* fix isMutationBelongsToElement function: make it return true if the whole text node is deleted inside of some descendant of the passed element

* isMutationBelongsToElement function shouldn't return true if some of the ancestors of the passed element were added or deleted, only if the element itself

* add test case verifying that 'onChange' is fired when the whole text inside some nested  descendant of the block is removed

* replace introduced dependency with ToolMock

* add comment explaining isMutationBelongsToElement behaviour in case of adding/removing the passed element itself

* fix formatting

* added some more explanation

* added record to the changelog

---------

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
2024-02-28 20:08:08 +03:00
Peter Savchenko
b619946e8f
fix(slash): do not handle / + shift/alt, support for ascii keyboard (#2599)
* fix(slash): do not handle / + shift/alt, support for ascii keyboard

* support keyboards without physical '/'
2024-01-28 13:45:01 +03:00
Betty Steger
4bdf7a12b7
chore(on-change): check data-mutation-free of parent nodes (#2548)
* add data-mutation-free=deep

* just use closest and reduce waiting time in test

* Update src/components/block/index.ts

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>

* Update test/cypress/tests/onchange.cy.ts

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>

* add data-mutation-free=deep

* just use closest and reduce waiting time in test

* Update src/components/block/index.ts

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>

* Update test/cypress/tests/onchange.cy.ts

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>

* add line in Changelog

* Update docs/CHANGELOG.md

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>

* add support for characterData mutations

* Update onchange.cy.ts

---------

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
2024-01-10 22:27:19 +03:00
Peter Savchenko
cd29c52e51
feat(ui): native-like tab behaviour, slash for toolbox (#2569)
* slash to open toolbox, tab for navigation

* tab, focus improvements

- remove "focused" block state
- tab navigation respects inputs
- allow to focus contentless blocks

* fix tests

* tests for Slash

* tab tests

* test for tabbing out of editor

* tests fixed

* review fixes
2023-12-22 23:15:35 +03:00
Peter Savchenko
c5854eea14
fix(inline-toolbar): appearance logic improved (#2550)
* fix(inline-toolbar): appearing logic improved

* tests added

* fix tests

* debounce added

* fix test build in github action

* increase closeTo delta for ff
2023-12-09 02:05:27 +03:00
Peter Savchenko
ee188bfe5d
feat(config): new style.nonce option for CSP (#2519) 2023-10-23 01:08:26 +03:00
Peter Savchenko
7d0db9b622
chore(patch): pull 2.28.1 patch to the next (#2507)
* fix(paste): delay onPaste call to be sure that block is ready (#2506)

* chore(package.json): increment patch version

* Update CHANGELOG.md
2023-10-11 20:28:16 +03:00
Peter Savchenko
0369ff5827
fix(renderer): handle empty array as data.blocks (#2454) 2023-09-05 11:24:47 +03:00
Peter Savchenko
42612a0fd9
chore(blocks.render): mutex for onchange added to the blocks.render() (#2449) 2023-08-21 12:28:31 +03:00
Peter Savchenko
922dfd8741
chore(api): blocks.update(id, data) method improved (#2443)
* add custom Chai assertion "be.calledWithBatchedEvents" for testing onchange

* chore(api): blocks.update(id, data) method improved

- `blocks.update(id, data)` now can accept partial data object — it will update only passed properties, others will remain the same.
- `blocks.update(id, data)` now will trigger onChange with only `block-change` event.
- `blocks.update(id, data)` will return a promise with BlockAPI object of changed block.

* fix tests

* Update blocks.cy.ts
2023-08-19 07:53:42 +03:00
Peter Savchenko
b39996616c
chore(perf): initialisation and rendering performance optimisations (#2430)
* renderer batching

* initialization and rendering performance optimized

* insertMany api method added

* Update index.html

* rm old method

* upd changelog

* upd paragraph

* paste tests fixed

* api blocks tests fixed

* backspace event tests fixed

* async issues in tests fixed

* eslint

* stub block added, tests added

* eslint

* eslint

* add test for insertMany()

* Update package.json
2023-08-08 22:17:09 +03:00
Peter Savchenko
022320940e
feat(shortcuts): convert block by tools shortcut (#2419)
* feat(conversion): allow to convert block using shortcut

* display shortcuts in conversion toolbar

* tests for the blocks.convert

* tests for the toolbox shortcuts

* Update CHANGELOG.md

* Update toolbox.cy.ts

* rm unused imports

* firefox test fixed

* test errors via to.throw
2023-07-20 23:27:18 +03:00
Peter Savchenko
b24bebbc40
feat(blocks-dom): block ids exported as data-id attribute (#2404) 2023-07-06 23:59:28 +03:00
Peter Savchenko
2ab9eb13bc
feat(block-events): delete keydown handling added (#2402)
* feat(block-events): delete keydown logic added

* chore(ui-events): delete keydown will remove selected blocks

* backspace tests added

* delete keydown tests

* tests for ui added

* fix ci

* separate block events tests for several files

* Delete BlockEvents.cy.ts

* rm unused change

* add code-review fixes + corner cases handling

* Update blockEvents.ts

* allow merging only same type blocks
2023-07-06 23:45:12 +03:00
Peter Savchenko
9e64003c0a
fix(onchange): support data-mutation-free on attributes chane (#2393) 2023-06-22 20:42:14 +03:00
Peter Savchenko
c8993332e3
fix(onchange): callback will be fired on removing of a whole text (#2392)
* fix(onchange): callback will be fired when the whole text is removed in a block

* whops
2023-06-21 20:32:25 +03:00
Peter Savchenko
b7b00fd060
chore(onChange): bugfix, batching, improvements of ModificationsObserver (#2349)
* block onchange stash

* improve block filtration

* update tool root

* chore(block): remove willSelect und willUnselect

* onchange events batching

* get rid of CustomEvent extension, create custom event map instead

* improve types of EventsDispatcher

* fix tests

* custom sinon + chai matchers

* improve tests, add mutex for fake cursor

* add test for fake-cursor mutex

* test for batch filtering

* fix caret setting by enter press at the end of the block

* test for detectToolRootChange

* remove resolved todos

* changelog added

* fix tests

* Update CHANGELOG.md

* rename FakeCursorAboutToBeSet -> FakeCursorAboutToBeToggled

* update didMutated statements

* move inputs cache clearing to a separate method

* rm Record inheritance from Event maps

* add type alisases

* rename isElementContainsFakeCursor ->  isFakeCursorInsideContainer

* improve code style
2023-05-12 20:50:48 +03:00
Taly
aafab1d395
Use Vite builder (#2300)
* vite builder initial

* save

* add displayName

* add paragraph from npm

* fix postcss apply

* remove some packages, fix tests

* Update cypress.yml

* remove logs

* remove unused packages

* update path to image

* update

* Update index.html

* Update cypress.yml

* Update cypress.yml

* Update cypress.yml

* remove displayName field

* update names

* Update index.ts

* Update index.ts

* update packages

* remove packages

* postcss preserve: true

* Update index.html

* Update editor-modules.d.ts

* use public dir for static

* Update vite.config.js

* update modules type

* Update CHANGELOG.md
2023-04-13 22:25:29 +03:00
Guillaume Leon
0491155e33
feat(toolbar-api): method for toggling toolbox (#2332)
* Expose toolbox control method

* Add test for toolbox

* rename method to toggleToolbox

* add missing test case

* Add changelog

* remove eslint rule

* Update changelog

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>

* fix linter problems

---------

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
2023-04-13 20:02:46 +03:00