Release/2.17 (#1063)

* 2.16.0

* [Refactor] Separate internal and external settings (#845)

* Enable flipping tools via standalone class (#830)

* Enable flipping tools via standalone class

* use flipper to refactor (#842)

* use flipper to refactor

* save changes

* update

* fix flipper on inline toolbar

* ready for testing

* requested changes

* update doc

* updates

* destroy flippers

* some requested changes

* update

* update

* ready

* update

* last changes

* update docs

* Hghl active button of CT, simplify activate/deactivate

* separate dom iterator

* unhardcode directions

* fixed a link in readme.md (#856)

* Fix Block selection via CMD+A (#829)

* Fix Block selection via CMD+A

* Delete editor.js.map

* update

* update

* Update CHANGELOG.md

* Improve style of selected blocks (#858)

* Cross-block-selection style improved

* Update CHANGELOG.md

* Fix case when property 'observer' in modificationObserver is not defined (#866)

* Bump lodash.template from 4.4.0 to 4.5.0 (#885)

Bumps [lodash.template](https://github.com/lodash/lodash) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.4.0...4.5.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump eslint-utils from 1.3.1 to 1.4.2 (#886)

Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.3.1 to 1.4.2.
- [Release notes](https://github.com/mysticatea/eslint-utils/releases)
- [Commits](https://github.com/mysticatea/eslint-utils/compare/v1.3.1...v1.4.2)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump mixin-deep from 1.3.1 to 1.3.2 (#887)

Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
- [Commits](https://github.com/jonschlinkert/mixin-deep/compare/1.3.1...1.3.2)

Signed-off-by: dependabot[bot] <support@github.com>

* update bundle and readme

* Update README.md

* upd codeowners, fix funding

* Minor Docs Fix according to main Readme (#916)

* Inline Toolbar now contains Conversion Toolbar (#932)

* Block lifecycle hooks (#906)

* [Fix] Arrow selection (#964)

* Fix arrow selection

* Add docs

* [issue-926]: fix dom iterator leafing when items are empty (#958)

* [issue-926]: fix dom iterator leafing when items are empty

* update Changelog

* Issue 869 (#963)

* Fix issue 943 (#965)

* [Draft] Feature/tooltip enhancements (#907)

* initial

* update

* make module standalone

* use tooltips as external module

* update

* build via prod mode

* add tooltips as external module

* add declaration file and options param

* add api tooltip

* update

* removed submodule

* removed due to the incorrect setip

* setup tooltips again

* wip

* update tooltip module

* toolbox, inline toolbar

* Tooltips in block tunes not uses shorthand

* shorthand in a plus and block settings

* fix doc

* Update tools-inline.md

* Delete tooltip.css

* Update CHANGELOG.md

* Update codex.tooltips

* Update api.md

* [issue-779]: Grammarly conflicts (#956)

* grammarly conflicts

* update

* upd bundle

* Submodule Header now on master

* Submodule Marker now on master

* Submodule Paragraph now on master

* Submodule InlineCode now on master

* Submodule Simple Image now on master

* [issue-868]: Deleting multiple blocks triggers back button in Firefox (#967)

* Deleting multiple blocks triggers back button in Firefox

@evgenusov

* Update editor.js

* Update CHANGELOG.md

* pass options on removeEventListener (#904)

* pass options on removeEventListener by removeAll

* rebuild

* Merge branch 'release/2.16' into pr/904

* Update CHANGELOG.md

* Update inline.ts

* [Fix] Selection rangecount (#968)

* Fix #952 (#969)

* Update codex.tooltips

* Selection bugfix (#970)

* Selection bugfix

* fix cross block selection

* close inline toolbar when blocks selected via shift

* remove inline toolbar closing on cross block selection mouse up due to the bug (#972)

* [Feature] Log levels (#971)

* Decrease margins (#973)

* Decrease margins

* Update editor.licenses.txt

* Update src/components/domIterator.ts

Co-Authored-By: Murod Khaydarov <murod.haydarov@gmail.com>

* [Fix] Fix delete blocks api method (#974)

* Update docs/usage.md

Co-Authored-By: Murod Khaydarov <murod.haydarov@gmail.com>

* rm unused

* Update yarn.lock file

* upd bundle, changelog

* Resolve Firefox issues (#981)

* Resolve Firefox issues

* use firefox hack only for empty c-e divs

* Set initial hidden Inline Toolbar position (#982)

Resolves #979

* [Fix] tooltip types (#986)

* Add tooltip as a package

* Fix to set minHeight 0px (#987)

* Release 2.16 (#966)

* 2.16.0

* [Refactor] Separate internal and external settings (#845)

* Enable flipping tools via standalone class (#830)

* Enable flipping tools via standalone class

* use flipper to refactor (#842)

* use flipper to refactor

* save changes

* update

* fix flipper on inline toolbar

* ready for testing

* requested changes

* update doc

* updates

* destroy flippers

* some requested changes

* update

* update

* ready

* update

* last changes

* update docs

* Hghl active button of CT, simplify activate/deactivate

* separate dom iterator

* unhardcode directions

* fixed a link in readme.md (#856)

* Fix Block selection via CMD+A (#829)

* Fix Block selection via CMD+A

* Delete editor.js.map

* update

* update

* Update CHANGELOG.md

* Improve style of selected blocks (#858)

* Cross-block-selection style improved

* Update CHANGELOG.md

* Fix case when property 'observer' in modificationObserver is not defined (#866)

* Bump lodash.template from 4.4.0 to 4.5.0 (#885)

Bumps [lodash.template](https://github.com/lodash/lodash) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.4.0...4.5.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump eslint-utils from 1.3.1 to 1.4.2 (#886)

Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.3.1 to 1.4.2.
- [Release notes](https://github.com/mysticatea/eslint-utils/releases)
- [Commits](https://github.com/mysticatea/eslint-utils/compare/v1.3.1...v1.4.2)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump mixin-deep from 1.3.1 to 1.3.2 (#887)

Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
- [Commits](https://github.com/jonschlinkert/mixin-deep/compare/1.3.1...1.3.2)

Signed-off-by: dependabot[bot] <support@github.com>

* update bundle and readme

* Update README.md

* upd codeowners, fix funding

* Minor Docs Fix according to main Readme (#916)

* Inline Toolbar now contains Conversion Toolbar (#932)

* Block lifecycle hooks (#906)

* [Fix] Arrow selection (#964)

* Fix arrow selection

* Add docs

* [issue-926]: fix dom iterator leafing when items are empty (#958)

* [issue-926]: fix dom iterator leafing when items are empty

* update Changelog

* Issue 869 (#963)

* Fix issue 943 (#965)

* [Draft] Feature/tooltip enhancements (#907)

* initial

* update

* make module standalone

* use tooltips as external module

* update

* build via prod mode

* add tooltips as external module

* add declaration file and options param

* add api tooltip

* update

* removed submodule

* removed due to the incorrect setip

* setup tooltips again

* wip

* update tooltip module

* toolbox, inline toolbar

* Tooltips in block tunes not uses shorthand

* shorthand in a plus and block settings

* fix doc

* Update tools-inline.md

* Delete tooltip.css

* Update CHANGELOG.md

* Update codex.tooltips

* Update api.md

* [issue-779]: Grammarly conflicts (#956)

* grammarly conflicts

* update

* upd bundle

* Submodule Header now on master

* Submodule Marker now on master

* Submodule Paragraph now on master

* Submodule InlineCode now on master

* Submodule Simple Image now on master

* [issue-868]: Deleting multiple blocks triggers back button in Firefox (#967)

* Deleting multiple blocks triggers back button in Firefox

@evgenusov

* Update editor.js

* Update CHANGELOG.md

* pass options on removeEventListener (#904)

* pass options on removeEventListener by removeAll

* rebuild

* Merge branch 'release/2.16' into pr/904

* Update CHANGELOG.md

* Update inline.ts

* [Fix] Selection rangecount (#968)

* Fix #952 (#969)

* Update codex.tooltips

* Selection bugfix (#970)

* Selection bugfix

* fix cross block selection

* close inline toolbar when blocks selected via shift

* remove inline toolbar closing on cross block selection mouse up due to the bug (#972)

* [Feature] Log levels (#971)

* Decrease margins (#973)

* Decrease margins

* Update editor.licenses.txt

* Update src/components/domIterator.ts

Co-Authored-By: Murod Khaydarov <murod.haydarov@gmail.com>

* [Fix] Fix delete blocks api method (#974)

* Update docs/usage.md

Co-Authored-By: Murod Khaydarov <murod.haydarov@gmail.com>

* rm unused

* Update yarn.lock file

* upd bundle, changelog

* Fix changeling list items (#975)

* Update changelog (#976)

* Fix to set minHeight 0px

* upd version

* Update CHANGELOG.md

* upd bundle

* [Fix] Selection issues (#988)

* [Dev] Update dependencies (#989)

* Delete codex.tooltips

* Update submodules

* Fix/hide conversion toolbar (#991)

* Hide conversion toolbar if there is no conversion tool

* update changelog

* update comment

* updates

* improve code

* Update Changelog

* Update CHANGELOG.md

* fix some problems at example

* Update CHANGELOG.md

* Fix: bind editor when calling onChange (#1048)

* Release/2.16.1 (#990)

* 2.16.0

* [Refactor] Separate internal and external settings (#845)

* Enable flipping tools via standalone class (#830)

* Enable flipping tools via standalone class

* use flipper to refactor (#842)

* use flipper to refactor

* save changes

* update

* fix flipper on inline toolbar

* ready for testing

* requested changes

* update doc

* updates

* destroy flippers

* some requested changes

* update

* update

* ready

* update

* last changes

* update docs

* Hghl active button of CT, simplify activate/deactivate

* separate dom iterator

* unhardcode directions

* fixed a link in readme.md (#856)

* Fix Block selection via CMD+A (#829)

* Fix Block selection via CMD+A

* Delete editor.js.map

* update

* update

* Update CHANGELOG.md

* Improve style of selected blocks (#858)

* Cross-block-selection style improved

* Update CHANGELOG.md

* Fix case when property 'observer' in modificationObserver is not defined (#866)

* Bump lodash.template from 4.4.0 to 4.5.0 (#885)

Bumps [lodash.template](https://github.com/lodash/lodash) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.4.0...4.5.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump eslint-utils from 1.3.1 to 1.4.2 (#886)

Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.3.1 to 1.4.2.
- [Release notes](https://github.com/mysticatea/eslint-utils/releases)
- [Commits](https://github.com/mysticatea/eslint-utils/compare/v1.3.1...v1.4.2)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump mixin-deep from 1.3.1 to 1.3.2 (#887)

Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
- [Commits](https://github.com/jonschlinkert/mixin-deep/compare/1.3.1...1.3.2)

Signed-off-by: dependabot[bot] <support@github.com>

* update bundle and readme

* Update README.md

* upd codeowners, fix funding

* Minor Docs Fix according to main Readme (#916)

* Inline Toolbar now contains Conversion Toolbar (#932)

* Block lifecycle hooks (#906)

* [Fix] Arrow selection (#964)

* Fix arrow selection

* Add docs

* [issue-926]: fix dom iterator leafing when items are empty (#958)

* [issue-926]: fix dom iterator leafing when items are empty

* update Changelog

* Issue 869 (#963)

* Fix issue 943 (#965)

* [Draft] Feature/tooltip enhancements (#907)

* initial

* update

* make module standalone

* use tooltips as external module

* update

* build via prod mode

* add tooltips as external module

* add declaration file and options param

* add api tooltip

* update

* removed submodule

* removed due to the incorrect setip

* setup tooltips again

* wip

* update tooltip module

* toolbox, inline toolbar

* Tooltips in block tunes not uses shorthand

* shorthand in a plus and block settings

* fix doc

* Update tools-inline.md

* Delete tooltip.css

* Update CHANGELOG.md

* Update codex.tooltips

* Update api.md

* [issue-779]: Grammarly conflicts (#956)

* grammarly conflicts

* update

* upd bundle

* Submodule Header now on master

* Submodule Marker now on master

* Submodule Paragraph now on master

* Submodule InlineCode now on master

* Submodule Simple Image now on master

* [issue-868]: Deleting multiple blocks triggers back button in Firefox (#967)

* Deleting multiple blocks triggers back button in Firefox

@evgenusov

* Update editor.js

* Update CHANGELOG.md

* pass options on removeEventListener (#904)

* pass options on removeEventListener by removeAll

* rebuild

* Merge branch 'release/2.16' into pr/904

* Update CHANGELOG.md

* Update inline.ts

* [Fix] Selection rangecount (#968)

* Fix #952 (#969)

* Update codex.tooltips

* Selection bugfix (#970)

* Selection bugfix

* fix cross block selection

* close inline toolbar when blocks selected via shift

* remove inline toolbar closing on cross block selection mouse up due to the bug (#972)

* [Feature] Log levels (#971)

* Decrease margins (#973)

* Decrease margins

* Update editor.licenses.txt

* Update src/components/domIterator.ts

Co-Authored-By: Murod Khaydarov <murod.haydarov@gmail.com>

* [Fix] Fix delete blocks api method (#974)

* Update docs/usage.md

Co-Authored-By: Murod Khaydarov <murod.haydarov@gmail.com>

* rm unused

* Update yarn.lock file

* upd bundle, changelog

* Resolve Firefox issues (#981)

* Resolve Firefox issues

* use firefox hack only for empty c-e divs

* Set initial hidden Inline Toolbar position (#982)

Resolves #979

* [Fix] tooltip types (#986)

* Add tooltip as a package

* Fix to set minHeight 0px (#987)

* Release 2.16 (#966)

* 2.16.0

* [Refactor] Separate internal and external settings (#845)

* Enable flipping tools via standalone class (#830)

* Enable flipping tools via standalone class

* use flipper to refactor (#842)

* use flipper to refactor

* save changes

* update

* fix flipper on inline toolbar

* ready for testing

* requested changes

* update doc

* updates

* destroy flippers

* some requested changes

* update

* update

* ready

* update

* last changes

* update docs

* Hghl active button of CT, simplify activate/deactivate

* separate dom iterator

* unhardcode directions

* fixed a link in readme.md (#856)

* Fix Block selection via CMD+A (#829)

* Fix Block selection via CMD+A

* Delete editor.js.map

* update

* update

* Update CHANGELOG.md

* Improve style of selected blocks (#858)

* Cross-block-selection style improved

* Update CHANGELOG.md

* Fix case when property 'observer' in modificationObserver is not defined (#866)

* Bump lodash.template from 4.4.0 to 4.5.0 (#885)

Bumps [lodash.template](https://github.com/lodash/lodash) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.4.0...4.5.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump eslint-utils from 1.3.1 to 1.4.2 (#886)

Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.3.1 to 1.4.2.
- [Release notes](https://github.com/mysticatea/eslint-utils/releases)
- [Commits](https://github.com/mysticatea/eslint-utils/compare/v1.3.1...v1.4.2)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump mixin-deep from 1.3.1 to 1.3.2 (#887)

Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
- [Commits](https://github.com/jonschlinkert/mixin-deep/compare/1.3.1...1.3.2)

Signed-off-by: dependabot[bot] <support@github.com>

* update bundle and readme

* Update README.md

* upd codeowners, fix funding

* Minor Docs Fix according to main Readme (#916)

* Inline Toolbar now contains Conversion Toolbar (#932)

* Block lifecycle hooks (#906)

* [Fix] Arrow selection (#964)

* Fix arrow selection

* Add docs

* [issue-926]: fix dom iterator leafing when items are empty (#958)

* [issue-926]: fix dom iterator leafing when items are empty

* update Changelog

* Issue 869 (#963)

* Fix issue 943 (#965)

* [Draft] Feature/tooltip enhancements (#907)

* initial

* update

* make module standalone

* use tooltips as external module

* update

* build via prod mode

* add tooltips as external module

* add declaration file and options param

* add api tooltip

* update

* removed submodule

* removed due to the incorrect setip

* setup tooltips again

* wip

* update tooltip module

* toolbox, inline toolbar

* Tooltips in block tunes not uses shorthand

* shorthand in a plus and block settings

* fix doc

* Update tools-inline.md

* Delete tooltip.css

* Update CHANGELOG.md

* Update codex.tooltips

* Update api.md

* [issue-779]: Grammarly conflicts (#956)

* grammarly conflicts

* update

* upd bundle

* Submodule Header now on master

* Submodule Marker now on master

* Submodule Paragraph now on master

* Submodule InlineCode now on master

* Submodule Simple Image now on master

* [issue-868]: Deleting multiple blocks triggers back button in Firefox (#967)

* Deleting multiple blocks triggers back button in Firefox

@evgenusov

* Update editor.js

* Update CHANGELOG.md

* pass options on removeEventListener (#904)

* pass options on removeEventListener by removeAll

* rebuild

* Merge branch 'release/2.16' into pr/904

* Update CHANGELOG.md

* Update inline.ts

* [Fix] Selection rangecount (#968)

* Fix #952 (#969)

* Update codex.tooltips

* Selection bugfix (#970)

* Selection bugfix

* fix cross block selection

* close inline toolbar when blocks selected via shift

* remove inline toolbar closing on cross block selection mouse up due to the bug (#972)

* [Feature] Log levels (#971)

* Decrease margins (#973)

* Decrease margins

* Update editor.licenses.txt

* Update src/components/domIterator.ts

Co-Authored-By: Murod Khaydarov <murod.haydarov@gmail.com>

* [Fix] Fix delete blocks api method (#974)

* Update docs/usage.md

Co-Authored-By: Murod Khaydarov <murod.haydarov@gmail.com>

* rm unused

* Update yarn.lock file

* upd bundle, changelog

* Fix changeling list items (#975)

* Update changelog (#976)

* Fix to set minHeight 0px

* upd version

* Update CHANGELOG.md

* upd bundle

* [Fix] Selection issues (#988)

* [Dev] Update dependencies (#989)

* Delete codex.tooltips

* Update submodules

* Fix/hide conversion toolbar (#991)

* Hide conversion toolbar if there is no conversion tool

* update changelog

* update comment

* updates

* improve code

* Update Changelog

* Update CHANGELOG.md

* Update CHANGELOG.md

* Fix: bind editor when calling onChange

fixes #999

* send api as a parameter

* upd bundle

* Update CHANGELOG.md

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

* updated some wording. (#1044)

* Release/2.16.1 (#990)

* 2.16.0

* [Refactor] Separate internal and external settings (#845)

* Enable flipping tools via standalone class (#830)

* Enable flipping tools via standalone class

* use flipper to refactor (#842)

* use flipper to refactor

* save changes

* update

* fix flipper on inline toolbar

* ready for testing

* requested changes

* update doc

* updates

* destroy flippers

* some requested changes

* update

* update

* ready

* update

* last changes

* update docs

* Hghl active button of CT, simplify activate/deactivate

* separate dom iterator

* unhardcode directions

* fixed a link in readme.md (#856)

* Fix Block selection via CMD+A (#829)

* Fix Block selection via CMD+A

* Delete editor.js.map

* update

* update

* Update CHANGELOG.md

* Improve style of selected blocks (#858)

* Cross-block-selection style improved

* Update CHANGELOG.md

* Fix case when property 'observer' in modificationObserver is not defined (#866)

* Bump lodash.template from 4.4.0 to 4.5.0 (#885)

Bumps [lodash.template](https://github.com/lodash/lodash) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.4.0...4.5.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump eslint-utils from 1.3.1 to 1.4.2 (#886)

Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.3.1 to 1.4.2.
- [Release notes](https://github.com/mysticatea/eslint-utils/releases)
- [Commits](https://github.com/mysticatea/eslint-utils/compare/v1.3.1...v1.4.2)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump mixin-deep from 1.3.1 to 1.3.2 (#887)

Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
- [Commits](https://github.com/jonschlinkert/mixin-deep/compare/1.3.1...1.3.2)

Signed-off-by: dependabot[bot] <support@github.com>

* update bundle and readme

* Update README.md

* upd codeowners, fix funding

* Minor Docs Fix according to main Readme (#916)

* Inline Toolbar now contains Conversion Toolbar (#932)

* Block lifecycle hooks (#906)

* [Fix] Arrow selection (#964)

* Fix arrow selection

* Add docs

* [issue-926]: fix dom iterator leafing when items are empty (#958)

* [issue-926]: fix dom iterator leafing when items are empty

* update Changelog

* Issue 869 (#963)

* Fix issue 943 (#965)

* [Draft] Feature/tooltip enhancements (#907)

* initial

* update

* make module standalone

* use tooltips as external module

* update

* build via prod mode

* add tooltips as external module

* add declaration file and options param

* add api tooltip

* update

* removed submodule

* removed due to the incorrect setip

* setup tooltips again

* wip

* update tooltip module

* toolbox, inline toolbar

* Tooltips in block tunes not uses shorthand

* shorthand in a plus and block settings

* fix doc

* Update tools-inline.md

* Delete tooltip.css

* Update CHANGELOG.md

* Update codex.tooltips

* Update api.md

* [issue-779]: Grammarly conflicts (#956)

* grammarly conflicts

* update

* upd bundle

* Submodule Header now on master

* Submodule Marker now on master

* Submodule Paragraph now on master

* Submodule InlineCode now on master

* Submodule Simple Image now on master

* [issue-868]: Deleting multiple blocks triggers back button in Firefox (#967)

* Deleting multiple blocks triggers back button in Firefox

@evgenusov

* Update editor.js

* Update CHANGELOG.md

* pass options on removeEventListener (#904)

* pass options on removeEventListener by removeAll

* rebuild

* Merge branch 'release/2.16' into pr/904

* Update CHANGELOG.md

* Update inline.ts

* [Fix] Selection rangecount (#968)

* Fix #952 (#969)

* Update codex.tooltips

* Selection bugfix (#970)

* Selection bugfix

* fix cross block selection

* close inline toolbar when blocks selected via shift

* remove inline toolbar closing on cross block selection mouse up due to the bug (#972)

* [Feature] Log levels (#971)

* Decrease margins (#973)

* Decrease margins

* Update editor.licenses.txt

* Update src/components/domIterator.ts

Co-Authored-By: Murod Khaydarov <murod.haydarov@gmail.com>

* [Fix] Fix delete blocks api method (#974)

* Update docs/usage.md

Co-Authored-By: Murod Khaydarov <murod.haydarov@gmail.com>

* rm unused

* Update yarn.lock file

* upd bundle, changelog

* Resolve Firefox issues (#981)

* Resolve Firefox issues

* use firefox hack only for empty c-e divs

* Set initial hidden Inline Toolbar position (#982)

Resolves #979

* [Fix] tooltip types (#986)

* Add tooltip as a package

* Fix to set minHeight 0px (#987)

* Release 2.16 (#966)

* 2.16.0

* [Refactor] Separate internal and external settings (#845)

* Enable flipping tools via standalone class (#830)

* Enable flipping tools via standalone class

* use flipper to refactor (#842)

* use flipper to refactor

* save changes

* update

* fix flipper on inline toolbar

* ready for testing

* requested changes

* update doc

* updates

* destroy flippers

* some requested changes

* update

* update

* ready

* update

* last changes

* update docs

* Hghl active button of CT, simplify activate/deactivate

* separate dom iterator

* unhardcode directions

* fixed a link in readme.md (#856)

* Fix Block selection via CMD+A (#829)

* Fix Block selection via CMD+A

* Delete editor.js.map

* update

* update

* Update CHANGELOG.md

* Improve style of selected blocks (#858)

* Cross-block-selection style improved

* Update CHANGELOG.md

* Fix case when property 'observer' in modificationObserver is not defined (#866)

* Bump lodash.template from 4.4.0 to 4.5.0 (#885)

Bumps [lodash.template](https://github.com/lodash/lodash) from 4.4.0 to 4.5.0.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.4.0...4.5.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump eslint-utils from 1.3.1 to 1.4.2 (#886)

Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.3.1 to 1.4.2.
- [Release notes](https://github.com/mysticatea/eslint-utils/releases)
- [Commits](https://github.com/mysticatea/eslint-utils/compare/v1.3.1...v1.4.2)

Signed-off-by: dependabot[bot] <support@github.com>

* Bump mixin-deep from 1.3.1 to 1.3.2 (#887)

Bumps [mixin-deep](https://github.com/jonschlinkert/mixin-deep) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/jonschlinkert/mixin-deep/releases)
- [Commits](https://github.com/jonschlinkert/mixin-deep/compare/1.3.1...1.3.2)

Signed-off-by: dependabot[bot] <support@github.com>

* update bundle and readme

* Update README.md

* upd codeowners, fix funding

* Minor Docs Fix according to main Readme (#916)

* Inline Toolbar now contains Conversion Toolbar (#932)

* Block lifecycle hooks (#906)

* [Fix] Arrow selection (#964)

* Fix arrow selection

* Add docs

* [issue-926]: fix dom iterator leafing when items are empty (#958)

* [issue-926]: fix dom iterator leafing when items are empty

* update Changelog

* Issue 869 (#963)

* Fix issue 943 (#965)

* [Draft] Feature/tooltip enhancements (#907)

* initial

* update

* make module standalone

* use tooltips as external module

* update

* build via prod mode

* add tooltips as external module

* add declaration file and options param

* add api tooltip

* update

* removed submodule

* removed due to the incorrect setip

* setup tooltips again

* wip

* update tooltip module

* toolbox, inline toolbar

* Tooltips in block tunes not uses shorthand

* shorthand in a plus and block settings

* fix doc

* Update tools-inline.md

* Delete tooltip.css

* Update CHANGELOG.md

* Update codex.tooltips

* Update api.md

* [issue-779]: Grammarly conflicts (#956)

* grammarly conflicts

* update

* upd bundle

* Submodule Header now on master

* Submodule Marker now on master

* Submodule Paragraph now on master

* Submodule InlineCode now on master

* Submodule Simple Image now on master

* [issue-868]: Deleting multiple blocks triggers back button in Firefox (#967)

* Deleting multiple blocks triggers back button in Firefox

@evgenusov

* Update editor.js

* Update CHANGELOG.md

* pass options on removeEventListener (#904)

* pass options on removeEventListener by removeAll

* rebuild

* Merge branch 'release/2.16' into pr/904

* Update CHANGELOG.md

* Update inline.ts

* [Fix] Selection rangecount (#968)

* Fix #952 (#969)

* Update codex.tooltips

* Selection bugfix (#970)

* Selection bugfix

* fix cross block selection

* close inline toolbar when blocks selected via shift

* remove inline toolbar closing on cross block selection mouse up due to the bug (#972)

* [Feature] Log levels (#971)

* Decrease margins (#973)

* Decrease margins

* Update editor.licenses.txt

* Update src/components/domIterator.ts

Co-Authored-By: Murod Khaydarov <murod.haydarov@gmail.com>

* [Fix] Fix delete blocks api method (#974)

* Update docs/usage.md

Co-Authored-By: Murod Khaydarov <murod.haydarov@gmail.com>

* rm unused

* Update yarn.lock file

* upd bundle, changelog

* Fix changeling list items (#975)

* Update changelog (#976)

* Fix to set minHeight 0px

* upd version

* Update CHANGELOG.md

* upd bundle

* [Fix] Selection issues (#988)

* [Dev] Update dependencies (#989)

* Delete codex.tooltips

* Update submodules

* Fix/hide conversion toolbar (#991)

* Hide conversion toolbar if there is no conversion tool

* update changelog

* update comment

* updates

* improve code

* Update Changelog

* Update CHANGELOG.md

* Update CHANGELOG.md

* updated some wording.

* Update installation.md

* Update CHANGELOG.md

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

* Fix grammar in readme.md (#1008)

* Update editor.js

* Paste listener on editors instead of document (#1025)

* Paste listener on editors instead of document

* add changelog

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

* Bump acorn from 6.4.0 to 6.4.1 (#1059)

Bumps [acorn](https://github.com/acornjs/acorn) from 6.4.0 to 6.4.1.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/6.4.0...6.4.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix flipper activate/deactivate when conversionToolbarOpened (#1001)

* Fix flipper activate/deactivate when conversionToolbarOpened

* fix bug with flipping inline toolbar

* update changelog

* added comment for new condition

* upd bundle

Co-authored-by: Murod Khaydarov <murod.haydarov@gmail.com>
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>

* [Issue-1057]: open new window by clicking anchor with ctrl (#1062)

* open new window when anchor clicked with ctrl

* delete source maps

* update function name

* update

* update changelog

* Fix settings box-sizing (#1013)

* Improvements: new Block Settings button style (#1064)

* [Feature] In-house copy paste (#1060)

* New block lifecycle hook and BlockToolAPI: "moved" (#1007)

* Update CHANGELOG.md

* feat: add swapped lifecycle hook

* feat: deprecate swap and add move instead

* feat: set fromIndex by default, add MoveEvent, add indices checks in blockManager

* refactor: MoveEvent interface more event-like; docs: added docs for MoveEvent

* fix asterix alignment due to tslint error

* fix tslint

* extending CustomEvent

* update bundle

* Update CHANGELOG.md

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
Co-authored-by: Murod Khaydarov <murod.haydarov@gmail.com>

* Change paste function of text/plain (#1014)

Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com>

* Improve paste function of multiple lines (#1016)

Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com>

* 2.17.0

* Update bundle

Co-authored-by: georgyb <yegor.berezhnoi@3d4medical.com>
Co-authored-by: George Berezhnoy <gohabereg@users.noreply.github.com>
Co-authored-by: Christof Jans <christof@loopfx.com>
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
Co-authored-by: VladimirZhdanov <vlzh@pm.me>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Chaitanya <yourchaitu@gmail.com>
Co-authored-by: Marina <marina.zadoyanchuk@gmail.com>
Co-authored-by: Hata <hato6502@gmail.com>
Co-authored-by: Mohamed El Bahja <mohamed.jss11@gmail.Com>
Co-authored-by: Danny Rubio <drbe4t@gmail.com>
Co-authored-by: darrelfrancis <20881844+darrelfrancis@users.noreply.github.com>
Co-authored-by: Emmanuel Francis Ramos Jr <ponnex@gmail.com>
Co-authored-by: Andrey Blinov <andrey.blinoff@gmail.com>
Co-authored-by: Stefan Natter <stefan@natter.at>
Co-authored-by: Georgy Berezhnoy <gohabereg@gmail.com>
This commit is contained in:
Murod Khaydarov 2020-03-14 23:47:04 +03:00 committed by GitHub
parent 737ba2abb4
commit be6f9b78f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 500 additions and 202 deletions

View file

@ -18,8 +18,6 @@ If you like Editor.js you can support project improvements and development of ne
👉 [https://opencollective.com/editorjs](https://opencollective.com/editorjs)
👉 Bitcoin: `3DCCemgtE6GrzehVpU6Sa2RJHFUUh8iT9q`
### Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/editorjs#sponsor)]
@ -36,11 +34,11 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
This project exists thanks to all the people who contribute. <img src="https://opencollective.com/editorjs/contributors.svg?width=890&button=false" />
We are really welcome new contributors. If you want to make some code with us, please take a look at the [Good First Tasks](https://github.com/codex-team/editor.js/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+task%22). You can write to us on `team@codex.so` or via special [Telegram chat](https://t.me/editorjsdev), or any other way.
We really welcome new contributors. If you want to make some code with us, please take a look at the [Good First Tasks](https://github.com/codex-team/editor.js/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+task%22). You can write to us on `team@codex.so` or via special [Telegram chat](https://t.me/editorjsdev), or any other way.
## Documentation
Please, visit [https://editorjs.io/](https://editorjs.io) to view all documentation articles.
Please visit [https://editorjs.io/](https://editorjs.io) to view all documentation articles.
- [Base concepts](https://editorjs.io/base-concepts)
- [Getting started](https://editorjs.io/getting-started)
@ -53,9 +51,9 @@ You can join a [Gitter-channel](https://gitter.im/codex-team/editor.js) or [Tele
## Changelog
See a whole [Changelog](/docs/CHANGELOG.md)
See the whole [Changelog](/docs/CHANGELOG.md)
## So how to use Editor.js
## How to use Editor.js
### Basics
@ -63,27 +61,27 @@ Editor.js is a Block-Styled editor. Blocks are structural units, of which the En
For example, `Paragraph`, `Heading`, `Image`, `Video`, `List` are Blocks. Each Block is represented by Plugin.
We have [many](http://github.com/editor-js/) ready-to-use Plugins and a [simple API](https://editorjs.io/tools-api) for creating new ones.
So how to use the Editor after [Installation](https://editorjs.io/getting-started).
How to use the Editor after [Installation](https://editorjs.io/getting-started).
- Create new Blocks by Enter or with the Plus Button
- Create new Blocks by pressing Enter or clicking the Plus Button
- Press `TAB` or click on the Plus Button to view the Toolbox
- Press `TAB` again to leaf Toolbox and select a Block you need. Then press Enter.
![](https://github.com/editor-js/list/raw/master/assets/example.gif)
- Select text fragment and apply a style or insert a link from the Inline Toolbar
- Select a text fragment and apply a style or insert a link from the Inline Toolbar
![](https://capella.pics/7ccbcfcd-1c49-4674-bea7-71021468a1bd.jpg)
- Use «three-dots» button on the right to open Block Settings. From here, you can move and delete a Block
or apply Tool's settings, if it provided. For example, set a Heading level or List style.
- Use the «three-dots» button on the right to open Block Settings. From here, you can move and delete a Block
or apply a Tool's settings, if it provided. For example, you can set a Heading level or List style.
![](https://capella.pics/01a55381-46cd-47c7-b92e-34765434f2ca.jpg)
### Shortcuts
We really appreciate shortcuts. So there are few presets.
A few shortcuts are preset as available.
Shortcut | Action | Restrictions
-- | -- | --
@ -94,7 +92,7 @@ Shortcut | Action | Restrictions
`CMD+I` | Italic style | On selection
`CMD+K` | Insert a link | On selection
Also we support shortcuts on the all type of Tools. Specify a shortcut with the Tools configuration. For example:
Each Tool can also have its own shortcuts. These are specified in the configuration of the Tool, for example:
```js
var editor = new EditorJS({
@ -123,9 +121,9 @@ There are few steps to run Editor.js on your site.
2. [Load Tools](#load-tools)
3. [Initialize Editor's instance](#create-editor-instance)
### Load Editor's core
### Step 1. Load Editor's core
Firstly you need to get Editor.js itself. It is a [minified script](dist/editor.js) with Editor's core and some default must-have tools.
Get Editor.js itself. It is a [minified script](dist/editor.js) with Editor's core and some default must-have tools.
Choose the most usable method of getting Editor for you.
@ -133,7 +131,7 @@ Choose the most usable method of getting Editor for you.
- Source from CDN
- Local file from project
#### Node.js
##### Option A. NPM install
Install the package via NPM or Yarn
@ -147,35 +145,29 @@ Include module in your application
const EditorJS = require('@editorjs/editorjs');
```
#### Use from CDN
##### Option B. Use a CDN
You can load specific version of package from [jsDelivr CDN](https://www.jsdelivr.com/package/npm/@editorjs/editorjs).
You can load EditorJS directly from from [jsDelivr CDN](https://www.jsdelivr.com/package/npm/@editorjs/editorjs).
`https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest`
Then require this script.
For example, place this in your HTML:
```html
<script src="..."></script>
<script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script>
```
#### Save sources to project
##### Option C. Save source within your project
Copy [editor.js](dist/editor.js) file to your project and load it.
Copy the [editor.js](dist/editor.js) file to your project and load it.
```html
<script src="editor.js"></script>
```
### Load Tools
### Step 2. Load the Tools that you want to make available
Each Block at the Editor.js is represented by [Tools](docs/tools.md). There are simple external scripts with their own logic. Probably you want to use several Block Tools that should be connected.
For example check out our [Header](https://github.com/editor-js/header) Tool that represents heading blocks.
You can install Header Tool by the same way as the Editor (Node.js, CDN, local file).
Check [Editor.js's community](https://github.com/editor-js/) to see more ready-to-use Tools.
Each Block is represented by a [Tool](docs/tools.md). Tools are simple external scripts with their own logic. For example, there is a [Header](https://github.com/editor-js/header) Tool into which you type your heading text. If you want to be able to use this, install the Header Tool the same way as the Editor (Node.js, CDN, local file).
**Example:** use Header from CDN
@ -183,7 +175,9 @@ Check [Editor.js's community](https://github.com/editor-js/) to see more ready-t
<script src="https://cdn.jsdelivr.net/npm/codex.editor.header@2.0.4/dist/bundle.js"></script>
```
### Create Editor instance
Check [Editor.js's community](https://github.com/editor-js/) to see more ready-to-use Tools.
### Step 3. Create Editor instance
Create an instance of Editor.js and pass [Configuration Object](types/configs/editor-config.d.ts) with `holderId` and tools list.

2
dist/editor.js vendored

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,7 @@
/*!
* Editor.js
*
* @version 2.16.1
* @version 2.17.0
*
* @licence Apache-2.0
* @author CodeX <https://codex.so>

11
dist/sprite.svg vendored
View file

@ -14,12 +14,11 @@
<path transform="rotate(45 280.675 51.325)" d="M191 191V73c0-5.523 4.477-10 10-10h25c5.523 0 10 4.477 10 10v118h118c5.523 0 10 4.477 10 10v25c0 5.523-4.477 10-10 10H236v118c0 5.523-4.477 10-10 10h-25c-5.523 0-10-4.477-10-10V236H73c-5.523 0-10-4.477-10-10v-25c0-5.523 4.477-10 10-10h118z"/>
</symbol>
<symbol id="dots" viewBox="0 0 18 4">
<g fill-rule="evenodd">
<circle cx="9" cy="2" r="2"/>
<circle cx="2" cy="2" r="2"/>
<circle cx="16" cy="2" r="2"/>
</g>
<symbol id="dots" viewBox="0 0 8 8">
<circle cx="6.5" cy="1.5" r="1.5"/>
<circle cx="6.5" cy="6.5" r="1.5"/>
<circle cx="1.5" cy="1.5" r="1.5"/>
<circle cx="1.5" cy="6.5" r="1.5"/>
</symbol>
<symbol id="italic" viewBox="0 0 4 11">

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

@ -1,31 +1,45 @@
# Changelog
### 2.17
- `Improvements` - Editor's [onchange callback](https://editorjs.io/configuration#editor-modifications-callback) now accepts an API as a parameter
- `Fix` - Some mistakes are fixed in [installation.md](installation.md)
- `Fix` - Fixed multiple paste callback triggering in a case when several editors are instantiated [#1011](https://github.com/codex-team/editor.js/issues/1011)
- `Fix` - Fixed inline toolbar flipper activation on closing conversion toolbar [#995](https://github.com/codex-team/editor.js/issues/995)
- `Improvements` - New window tab is opened by clicking on anchor with ctrl [#1057](https://github.com/codex-team/editor.js/issues/1057)
- `Fix` - Fix block-tune buttons alignment in some CSS-resetors that forces `box-sizing: border-box` rule [#1003](https://github.com/codex-team/editor.js/issues/1003)
- `Improvements` - New style of a Block Settings button. Focused block background removed.
- `New` — Add in-house copy-paste support through `application/x-editor-js` mime-type
- `New` Block [lifecycle hook](tools.md#block-lifecycle-hooks) `moved`
- `Deprecated` — [`blocks.swap(fromIndex, toIndex)`](api.md) method is deprecated. Use `blocks.move(toIndex, fromIndex)` instead.
- `Fix` — Improve plain text paste [#1012](https://github.com/codex-team/editor.js/issues/1012)
- `Fix` — Fix multiline paste [#1015](https://github.com/codex-team/editor.js/issues/1015)
### 2.16.1
- `Fix` — Fix Firefox bug with incorrect height and cursor position of empty content editable elements [#947](https://github.com/codex-team/editor.js/issues/947) [#876](https://github.com/codex-team/editor.js/issues/876) [#608](https://github.com/codex-team/editor.js/issues/608) [#876](https://github.com/codex-team/editor.js/issues/876)
- `Fix` — Set initial hidden Inline Toolbar position [#979](https://github.com/codex-team/editor.js/issues/979)
- `Fix` — Fix issue with CodeX.Toolips TypeScript definitions [#978](https://github.com/codex-team/editor.js/issues/978)
- `Fix` — Set initial hidden Inline Toolbar position [#979](https://github.com/codex-team/editor.js/issues/979)
- `Fix` — Fix issue with CodeX.Toolips TypeScript definitions [#978](https://github.com/codex-team/editor.js/issues/978)
- `Fix` — Fix some issues with Inline and Tunes toolbars.
- `Fix` - Fix `minHeight` option with zero-value issue [#724](https://github.com/codex-team/editor.js/issues/724)
- `Improvements` — Disable Conversion Toolbar if there are no Tools to convert [#984](https://github.com/codex-team/editor.js/issues/984)
- `Improvements` — Disable Conversion Toolbar if there are no Tools to convert [#984](https://github.com/codex-team/editor.js/issues/984)
### 2.16
- `Improvements` — Inline Toolbar design improved
- `Improvements` — Conversion Toolbar now included in the Inline Toolbar [#853](https://github.com/codex-team/editor.js/issues/853)
- `Improvements` — All buttons now have beautiful Tooltips provided by [CodeX Tooltips](https://github.com/codex-team/codex.tooltips)
- `New` — new Tooltips API for displaying tooltips near your custom elements
- `New` — new Tooltips API for displaying tooltips near your custom elements
- `New` *API* — Block [lifecycle hooks](tools.md#block-lifecycle-hooks)
- `New` *Inline Tools API* — Ability to specify Tool's title via `title` static getter.
- `New` *Inline Tools API* — Ability to specify Tool's title via `title` static getter.
- `Fix` — On selection from end to start backspace is working as expected now [#869](https://github.com/codex-team/editor.js/issues/869)
- `Fix` — Fix flipper with empty dom iterator [#926](https://github.com/codex-team/editor.js/issues/926)
- `Fix` — Normalize node before walking through children at `isEmpty` method [#943](https://github.com/codex-team/editor.js/issues/943)
- `Fix` — Fixed Grammarly conflict [#779](https://github.com/codex-team/editor.js/issues/779)
- `Improvements` — Module Listeners now correctly removes events with options [#904](https://github.com/codex-team/editor.js/pull/904)
- `Improvements` — Styles API: `.cdx-block` default vertical margins decreased from 0.7 to 0.4 ems.
- `Fix` — Fixed History Back on block deletion by Backspace in Firefox [#967](https://github.com/codex-team/editor.js/pull/967)
- `Improvements` — Styles API: `.cdx-block` default vertical margins decreased from 0.7 to 0.4 ems.
- `Fix` — Fixed `getRangeCount` call if range count is 0 [#938](https://github.com/codex-team/editor.js/issues/938)
- `New` — Log levels now available to suppress Editor.js console messages [#962](https://github.com/codex-team/editor.js/issues/962)
- `New` — Log levels now available to suppress Editor.js console messages [#962](https://github.com/codex-team/editor.js/issues/962)
- `Fix` — Fixed wrong navigation on block deletion
### 2.15.1
@ -38,10 +52,10 @@
### 2.15
- `New` — New [`blocks.insert()`](api.md) API method [#715](https://github.com/codex-team/editor.js/issues/715).
- `New` — New [`blocks.insert()`](api.md) API method [#715](https://github.com/codex-team/editor.js/issues/715).
- `New` *Conversion Toolbar* — Ability to convert one block to another [#704](https://github.com/codex-team/editor.js/issues/704)
- `New` *Cross-block selection* — Ability to select multiple blocks by mouse and with SHIFT+ARROWS [#703](https://github.com/codex-team/editor.js/issues/703)
- `Deprecated` — [`blocks.insertNewBlock()`](api.md) method is deprecated. Use `blocks.insert()` instead.
- `Deprecated` — [`blocks.insertNewBlock()`](api.md) method is deprecated. Use `blocks.insert()` instead.
- `Improvements` — Inline Toolbar now works on mobile devices [#706](https://github.com/codex-team/editor.js/issues/706)
- `Improvements` — Toolbar looks better on mobile devices [#706](https://github.com/codex-team/editor.js/issues/706)
- `Improvements` — Now `pasteConfig` can return `false` to disable paste handling on your Tool [#801](https://github.com/codex-team/editor.js/issues/801)
@ -67,9 +81,9 @@
- `Deprecated` *Config* - `holderId` property now is deprecated and will removed in next major release. Use `holder` instead.
- `Fix` *Types* — Fixed error with `codex-notifier` package [#713](https://github.com/codex-team/editor.js/issues/713)
- `Improvements` — Close inline toolbar after creating a new link.
- `New` *Config* — Option `minHeight` for customizing Editor's bottom zone height added.
- `New` *Config* — Option `minHeight` for customizing Editor's bottom zone height added.
### 2.12.4
### 2.12.4
- `Improvements` — CodeX.Shortcuts version updated to the v1.1 [#684](https://github.com/codex-team/editor.js/issues/684)
- `Fix` — Do not start multi-block selection on Toolbox and Inline Toolbar [#646](https://github.com/codex-team/editor.js/issues/646)
@ -82,15 +96,15 @@
### 2.12.2
- New *Inline Tools* — pass tool settings from configuration to Tool constructor
- New *Inline Tools* — pass tool settings from configuration to Tool constructor
### 2.12.1
- `Fix` — Fix processing `color-mod` function in styles
### 2.12.0
### 2.12.0
- `New` *API* - new `blocks` API method `renderFromHTML`
- `New` *API* - new `blocks` API method `renderFromHTML`
### 2.11.11
@ -102,7 +116,7 @@
### 2.11.9
- `Fix` - Fix inline toolbar buttons margin. Update dependencies list. Update tools for example page.
- `Fix` - Fix inline toolbar buttons margin. Update dependencies list. Update tools for example page.
### 2.11.8
@ -192,7 +206,7 @@
- `Fix` — cmd+x works only for custom selection now
### 2.7.28
### 2.7.28
- `New` [Tools Validation](https://github.com/codex-team/editor.js/blob/master/docs/tools.md#validate-optional) is added.
@ -222,9 +236,9 @@
- `New` *Sanitize API* — [Sanitize Config](https://github.com/codex-team/editor.js/blob/master/docs/tools.md#automatic-sanitize) of `Block Tools` now automatically extends by tags of `Inline Tools` that is enabled by current Tool by `inlineToolbar` option. You don't need more to specify `a, b, mark, code` manually. This feature will be added to fields that supports inline markup.
- `New` *Block Selection* — Ability to select Block by `CMD+A`, and the whole Editor by double `CMD+A`. After that, you can copy (`CMD+C`), remove (`Backspace`) or clear (`Enter`) selected Blocks.
- `New` *[Styles API](https://github.com/codex-team/editor.js/blob/master/types/api/styles.d.ts)* — Added `button` class for stylization of any buttons provided by Tools with one unified style.
- `New` *[Notifier API](https://github.com/codex-team/editor.js/blob/master/docs/api.md#notifierapi)* — methods for showing user notifications: on success, errors, warnings, etc.
- `New` *Block Tool* — [Table](http://github.com/editor-js/table) constructor 💪
- `New` If one of the Tools is unavailable on Editor initialization, its Blocks will be rendered with *Dummy Block*, describing that user can not edit content of this Block. Dummy Blocks can be moved, removed and saved as normal Blocks. So saved data won't be lost if one of the Tools is failed
- `New` *[Notifier API](https://github.com/codex-team/editor.js/blob/master/docs/api.md#notifierapi)* — methods for showing user notifications: on success, errors, warnings, etc.
- `New` *Block Tool* — [Table](http://github.com/editor-js/table) constructor 💪
- `New` If one of the Tools is unavailable on Editor initialization, its Blocks will be rendered with *Dummy Block*, describing that user can not edit content of this Block. Dummy Blocks can be moved, removed and saved as normal Blocks. So saved data won't be lost if one of the Tools is failed
- `New` [Public TS-types](https://github.com/codex-team/editor.js/tree/master/types) are presented.
- `Changes` *Tools API* — options `irreplaceable` and `contentless` was removed.
- `Changes` *Tools API* — [Paste API](https://github.com/codex-team/editor.js/blob/master/docs/tools.md#paste-handling): tags, patterns and mime-types now should be specified by Tool's `pasteConfig` static property. Custom Paste Event should be handled by `onPaste(event)` that should not be static from now.

View file

@ -26,7 +26,11 @@ Methods that working with Blocks
`renderFromHTML(data)` - parse and render passed HTML string (*not for production use*)
`swap(fromIndex, toIndex)` - swaps two Blocks by their positions
`swap(fromIndex, toIndex)` - swaps two Blocks by their positions (deprecated:
use 'move' instead)
`move(toIndex, fromIndex)` - moves block from one index to another position.
`fromIndex` will be the current block's index by default.
`delete(blockIndex?: Number)` - deletes Block with passed index

View file

@ -10,11 +10,11 @@ There are few steps to run Editor.js on your site.
Firstly you need to get Editor.js itself. It is a [minified script](../dist/editor.js) with minimal available
Choose the most usable method of getting Editor for you.
Choose the most usable method of getting an Editor for you.
- Node package
- Source from CDN
- Local file from project
- Local file from a project
### Node.js
@ -52,11 +52,11 @@ Copy [editor.js](../dist/editor.js) file to your project and load it.
## Load Tools
Each Block at the Editor.js represented by [Tools](tools.md). There are simple external scripts with own logic. Probably you want to use several Block Tools that should be connected.
Each Block at the Editor.js represented by [Tools](tools.md). There are simple external scripts with their own logic. You'll probably want to use several Block Tools that should be connected.
For example check out our [Header](https://github.com/editor-js/header) Tool that represents heading blocks.
For example, check out our [Header](https://github.com/editor-js/header) Tool that represents heading blocks.
You can install Header Tool via the same ways as an Editor (Node.js, CDN, local file).
You can install the Header Tool via the same ways as an Editor (Node.js, CDN, local file).
Check [Editor.js's community](https://github.com/editor-js/) to see Tools examples.
@ -69,7 +69,7 @@ Check [Editor.js's community](https://github.com/editor-js/) to see Tools exampl
## Create Editor instance
Create an instance of Editor.js and pass [Configuration Object](../src/types-internal/editor-config.ts).
Minimal params is a `holderId`, `tools` list and `initialBlock` marker.
At least the `holderId` option is required.
```html
<div id="editorjs"></div>
@ -115,9 +115,9 @@ var editor = new EditorJS({
## Ready callback
Editor.js needs a bit time to initialize. It is an asynchronous action so it won't block execution of your main script.
Editor.js needs a bit of time to initialize. It is an asynchronous action so it won't block execution of your main script.
If you need to know when editor instance is ready you can use one of following ways:
If you need to know when the editor instance is ready you can use one of the following ways:
##### Pass `onReady` property to the configuration object.
@ -136,9 +136,9 @@ var editor = new EditorJS({
#### Use `isReady` promise.
After you create new `EditorJS` object it contains `isReady` property.
It is a Promise object resolved when editor is ready to work and rejected otherwise.
If there is an error during initialization `isReady` promise will be rejected with error message.
After you create a new `EditorJS` object it will contain `isReady` property.
It is a Promise object that resolves when the editor will be ready to work and rejected otherwise.
If there is an error during initialization `isReady` promise will be rejected with an error message.
```javascript
var editor = new EditorJS();
@ -179,7 +179,7 @@ editor.saver.save()
## Features
Also Editor.js provides useful methods to work with Editor's state.
Also, Editor.js provides useful methods to work with Editor's state.
```javascript
var editor = new EditorJS({

View file

@ -476,3 +476,8 @@ Called each time Block contents is updated
### `removed()`
Called after Block contents is removed from the page but before Block instance deleted
### `moved(MoveEvent)`
Called after Block was moved. `MoveEvent` contains `fromIndex` and `toIndex`
respectively.

BIN
example/assets/codex2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

View file

@ -108,10 +108,7 @@
/**
* Or pass class directly without any configuration
*/
image: {
class: SimpleImage,
inlineToolbar: ['link'],
},
image: SimpleImage,
list: {
class: List,
@ -265,7 +262,7 @@
{
type: 'image',
data: {
url: 'https://capella.pics/bbe6896c-ca1f-439e-8cb6-ebfda0d397d6.jpg',
url: 'assets/codex2x.png',
caption: '',
stretched: false,
withBorder: true,

View file

@ -99,10 +99,7 @@
/**
* Or pass class directly without any configuration
*/
image: {
class: SimpleImage,
inlineToolbar: ['link'],
},
image: SimpleImage,
list: {
class: List,
@ -254,7 +251,7 @@
{
type: 'image',
data: {
url: 'https://capella.pics/bbe6896c-ca1f-439e-8cb6-ebfda0d397d6.jpg',
url: 'assets/codex2x.png',
caption: '',
stretched: false,
withBorder: true,

View file

@ -1,6 +1,6 @@
{
"name": "@editorjs/editorjs",
"version": "2.16.1",
"version": "2.17.0",
"description": "Editor.js — Native JS, based on API and Open Source",
"main": "dist/editor.js",
"types": "./types/index.d.ts",

View file

@ -1,7 +1,6 @@
<svg width="18" height="4" viewBox="0 0 18 4" xmlns="http://www.w3.org/2000/svg">
<g fill-rule="evenodd">
<circle cx="9" cy="2" r="2"/>
<circle cx="2" cy="2" r="2"/>
<circle cx="16" cy="2" r="2"/>
</g>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 8 8">
<circle cx="6.5" cy="1.5" r="1.5"/>
<circle cx="6.5" cy="6.5" r="1.5"/>
<circle cx="1.5" cy="1.5" r="1.5"/>
<circle cx="1.5" cy="6.5" r="1.5"/>
</svg>

Before

Width:  |  Height:  |  Size: 225 B

After

Width:  |  Height:  |  Size: 218 B

View file

@ -92,7 +92,7 @@ export default class MoveDownTune implements BlockTune {
window.scrollTo(0, scrollOffset);
/** Change blocks positions */
this.api.blocks.swap(currentBlockIndex, currentBlockIndex + 1);
this.api.blocks.move(currentBlockIndex + 1);
/** Hide the Tooltip */
this.api.tooltip.hide();

View file

@ -46,7 +46,7 @@ export default class MoveUpTune implements BlockTune {
'click',
(event) => this.handleClick(event as MouseEvent, moveUpButton),
false,
);
);
/**
* Enable tooltip module on button
@ -99,7 +99,7 @@ export default class MoveUpTune implements BlockTune {
window.scrollBy(0, -1 * scrollUpOffset);
/** Change blocks positions */
this.api.blocks.swap(currentBlockIndex, currentBlockIndex - 1);
this.api.blocks.move(currentBlockIndex - 1);
/** Hide the Tooltip */
this.api.tooltip.hide();

View file

@ -38,6 +38,7 @@ export enum BlockToolAPI {
*/
APPEND_CALLBACK = 'appendCallback',
RENDERED = 'rendered',
MOVED = 'moved',
UPDATED = 'updated',
REMOVED = 'removed',
ON_PASTE = 'onPaste',
@ -441,7 +442,7 @@ export default class Block {
* @param {Object} data
*/
public async mergeWith(data: BlockToolData): Promise<void> {
await this.tool.merge(data);
await this.tool.merge(data);
}
/**
* Extracts data from Block
@ -465,7 +466,7 @@ export default class Block {
return {
tool: this.name,
data: finishedExtraction,
time : measuringEnd - measuringStart,
time: measuringEnd - measuringStart,
};
})
.catch((error) => {
@ -562,7 +563,7 @@ export default class Block {
private compose(): HTMLDivElement {
const wrapper = $.make('div', Block.CSS.wrapper) as HTMLDivElement,
contentNode = $.make('div', Block.CSS.content),
pluginsContent = this.tool.render();
pluginsContent = this.tool.render();
contentNode.appendChild(pluginsContent);
wrapper.appendChild(contentNode);

View file

@ -1,6 +1,7 @@
import * as _ from './utils';
import $ from './dom';
import Block, {BlockToolAPI} from './block';
import Block, { BlockToolAPI } from './block';
import {MoveEvent, MoveEventDetail} from '../../types/tools';
/**
* @class Blocks
@ -127,6 +128,7 @@ export default class Blocks {
* Swaps blocks with indexes first and second
* @param {Number} first - first block index
* @param {Number} second - second block index
* @deprecated use 'move' instead
*/
public swap(first: number, second: number): void {
const secondBlock = this.blocks[second];
@ -143,6 +145,42 @@ export default class Blocks {
this.blocks[first] = secondBlock;
}
/**
* Move a block from one to another index
* @param {Number} toIndex - new index of the block
* @param {Number} fromIndex - block to move
*/
public move(toIndex: number, fromIndex: number): void {
/**
* cut out the block, move the DOM element and insert at the desired index
* again (the shifting within the blocks array will happen automatically).
* @see https://stackoverflow.com/a/44932690/1238150
*/
const block = this.blocks.splice(fromIndex, 1)[0];
// manipulate DOM
const prevIndex = toIndex - 1;
const previousBlockIndex = Math.max(0, prevIndex);
const previousBlock = this.blocks[previousBlockIndex];
if (toIndex > 0) {
this.insertToDOM(block, 'afterend', previousBlock);
} else {
this.insertToDOM(block, 'beforebegin', previousBlock);
}
// move in array
this.blocks.splice(toIndex, 0, block);
// invoke hook
const event: MoveEvent = this.composeBlockEvent('move', {
fromIndex,
toIndex,
});
block.call(BlockToolAPI.MOVED, event);
}
/**
* Insert new Block at passed index
*
@ -261,4 +299,17 @@ export default class Blocks {
block.call(BlockToolAPI.RENDERED);
}
/**
* Composes Block event with passed type and details
*
* @param {String} type
* @param {MoveEventDetail} detail
*/
private composeBlockEvent(type: string, detail: MoveEventDetail): MoveEvent {
return new CustomEvent(type, {
detail,
},
) as MoveEvent;
}
}

View file

@ -130,6 +130,7 @@ export default class Dom {
* Swap two elements in parent
* @param {HTMLElement} el1 - from
* @param {HTMLElement} el2 - to
* @deprecated
*/
public static swap(el1: HTMLElement, el2: HTMLElement): void {
// create marker element and insert it where el1 is
@ -547,4 +548,13 @@ export default class Dom {
return node && extensions.includes(node.nodeName);
}
/**
* Returns true if element is anchor (is A tag)
*
* @param element
*/
public static isAnchor(element: Element): boolean {
return element.tagName.toLowerCase() === 'a';
}
}

@ -0,0 +1 @@
Subproject commit 72a7c01b6589fbe5591f63d0501c898a47d22875

View file

@ -20,6 +20,7 @@ export default class BlocksAPI extends Module {
renderFromHTML: (data: string) => this.renderFromHTML(data),
delete: () => this.delete(),
swap: (fromIndex: number, toIndex: number) => this.swap(fromIndex, toIndex),
move: (toIndex: number, fromIndex?: number) => this.move(toIndex, fromIndex),
getBlockByIndex: (index: number) => this.getBlockByIndex(index),
getCurrentBlockIndex: () => this.getCurrentBlockIndex(),
getBlocksCount: () => this.getBlocksCount(),
@ -60,6 +61,7 @@ export default class BlocksAPI extends Module {
* Call Block Manager method that swap Blocks
* @param {number} fromIndex - position of first Block
* @param {number} toIndex - position of second Block
* @deprecated use 'move' instead
*/
public swap(fromIndex: number, toIndex: number): void {
this.Editor.BlockManager.swap(fromIndex, toIndex);
@ -71,6 +73,21 @@ export default class BlocksAPI extends Module {
this.Editor.Toolbar.move(false);
}
/**
* Move block from one index to another
* @param {Number} toIndex
* @param {number} fromIndex
*/
public move(toIndex: number, fromIndex?: number): void {
this.Editor.BlockManager.move(toIndex, fromIndex);
/**
* Move toolbar
* DO not close the settings
*/
this.Editor.Toolbar.move(false);
}
/**
* Deletes Block
* @param blockIndex

View file

@ -211,47 +211,34 @@ export default class BlockEvents extends Module {
* Copying selected blocks
* Before putting to the clipboard we sanitize all blocks and then copy to the clipboard
*
* @param event
* @param {ClipboardEvent} event
*/
public handleCommandC(event): void {
public handleCommandC(event: ClipboardEvent): void {
const { BlockSelection } = this.Editor;
if (!BlockSelection.anyBlockSelected) {
return;
}
/**
* Prevent default copy
* Remove "decline sound" on macOS
*/
event.preventDefault();
// Copy Selected Blocks
BlockSelection.copySelectedBlocks();
BlockSelection.copySelectedBlocks(event);
}
/**
* Copy and Delete selected Blocks
* @param event
* @param {ClipboardEvent} event
*/
public handleCommandX(event): void {
public handleCommandX(event: ClipboardEvent): void {
const { BlockSelection, BlockManager, Caret } = this.Editor;
if (!BlockSelection.anyBlockSelected) {
return;
}
/**
* Copy Blocks before removing
*
* Prevent default copy
* Remove "decline sound" on macOS
*/
event.preventDefault();
BlockSelection.copySelectedBlocks();
BlockSelection.copySelectedBlocks(event);
const selectionPositionIndex = BlockManager.removeSelectedBlocks();
Caret.setToBlock(BlockManager.insertInitialBlockAtIndex(selectionPositionIndex, true), Caret.positions.START);
/** Clear selection */

View file

@ -160,7 +160,7 @@ export default class BlockManager extends Module {
*/
public async prepare() {
const blocks = new Blocks(this.Editor.UI.nodes.redactor);
const { BlockEvents, Shortcuts } = this.Editor;
const { BlockEvents, Listeners } = this.Editor;
/**
* We need to use Proxy to overload set/get [] operator.
@ -181,21 +181,19 @@ export default class BlockManager extends Module {
get: Blocks.get,
});
/** Copy shortcut */
Shortcuts.add({
name: 'CMD+C',
handler: (event) => {
BlockEvents.handleCommandC(event);
},
});
/** Copy event */
Listeners.on(
document,
'copy',
(e: ClipboardEvent) => BlockEvents.handleCommandC(e),
);
/** Copy and cut */
Shortcuts.add({
name: 'CMD+X',
handler: (event) => {
BlockEvents.handleCommandX(event);
},
});
Listeners.on(
document,
'cut',
(e: ClipboardEvent) => BlockEvents.handleCommandX(e),
);
}
/**
@ -433,15 +431,17 @@ export default class BlockManager extends Module {
* Replace current working block
*
* @param {String} toolName plugin name
* @param {Object} data plugin data
* @param {BlockToolData} data plugin data
* @param {ToolConfig} settings plugin config
*
* @return {Block}
*/
public replace(
toolName: string = this.config.initialBlock,
data: BlockToolData = {},
settings: ToolConfig = {},
): Block {
const block = this.composeBlock(toolName, data);
const block = this.composeBlock(toolName, data, settings);
this._blocks.insert(this.currentBlockIndex, block, true);
@ -552,6 +552,7 @@ export default class BlockManager extends Module {
* Swap Blocks Position
* @param {Number} fromIndex
* @param {Number} toIndex
* @deprecated use 'move' instead
*/
public swap(fromIndex, toIndex): void {
/** Move up current Block */
@ -561,6 +562,30 @@ export default class BlockManager extends Module {
this.currentBlockIndex = toIndex;
}
/**
* Move a block to a new index
* @param {Number} toIndex
* @param {Number} fromIndex
*/
public move(toIndex, fromIndex = this.currentBlockIndex): void {
// make sure indexes are valid and within a valid range
if (isNaN(toIndex) || isNaN(fromIndex)) {
_.log(`Warning during 'move' call: incorrect indices provided.`, 'warn');
return;
}
if (!this.validateIndex(toIndex) || !this.validateIndex(fromIndex)) {
_.log(`Warning during 'move' call: indices cannot be lower than 0 or greater than the amount of blocks.`, 'warn');
return;
}
/** Move up current Block */
this._blocks.move(toIndex, fromIndex);
/** Now actual block moved so that current block index changed */
this.currentBlockIndex = toIndex;
}
/**
* Sets current Block Index -1 which means unknown
* and clear highlightings
@ -604,4 +629,16 @@ export default class BlockManager extends Module {
Listeners.on(block.holder, 'dragover', (event) => BlockEvents.dragOver(event as DragEvent));
Listeners.on(block.holder, 'dragleave', (event) => BlockEvents.dragLeave(event as DragEvent));
}
/**
* Validates that the given index is not lower than 0 or higher than the amount of blocks
* @param {number} index - index of blocks array to validate
*/
private validateIndex(index: number): boolean {
if (index < 0 || index >= this._blocks.length) {
return false;
}
return true;
}
}

View file

@ -207,8 +207,17 @@ export default class BlockSelection extends Module {
/**
* Reduce each Block and copy its content
*
* @param {ClipboardEvent} e - copy/cut event
*
* @return Promise<void>
*/
public copySelectedBlocks(): void {
public async copySelectedBlocks(e: ClipboardEvent): Promise<void> {
/**
* Prevent default copy
*/
e.preventDefault();
const fakeClipboard = $.make('div');
this.selectedBlocks.forEach((block) => {
@ -220,9 +229,16 @@ export default class BlockSelection extends Module {
fragment.innerHTML = cleanHTML;
fakeClipboard.appendChild(fragment);
});
});
_.copyTextToClipboard(fakeClipboard.innerHTML);
const savedData = await Promise.all(this.selectedBlocks.map((block) => block.save()));
const textPlain = Array.from(fakeClipboard.childNodes).map((node) => node.textContent).join('\n\n');
const textHTML = fakeClipboard.innerHTML;
e.clipboardData.setData('text/plain', textPlain);
e.clipboardData.setData('text/html', textHTML);
e.clipboardData.setData(this.Editor.Paste.MIME_TYPE, JSON.stringify(savedData));
}
/**

View file

@ -33,7 +33,7 @@ export default class ModificationsObserver extends Module {
*/
private mutationDebouncer = _.debounce( () => {
this.updateNativeInputs();
this.config.onChange();
this.config.onChange(this.Editor.API.methods);
}, ModificationsObserver.DebounceTimer);
/**

View file

@ -4,6 +4,7 @@ import * as _ from '../utils';
import {
BlockTool,
BlockToolConstructable,
BlockToolData,
PasteConfig,
PasteEvent,
PasteEventDetail,
@ -102,6 +103,9 @@ export default class Paste extends Module {
/** If string`s length is greater than this number we don't check paste patterns */
public static readonly PATTERN_PROCESSING_MAX_LENGTH = 450;
/** Custom EditorJS mime-type to handle in-editor copy/paste actions */
public readonly MIME_TYPE = 'application/x-editor-js';
/**
* Tags` substitutions parameters
*/
@ -156,9 +160,21 @@ export default class Paste extends Module {
return;
}
const editorJSData = dataTransfer.getData(this.MIME_TYPE);
const plainData = dataTransfer.getData('text/plain');
let htmlData = dataTransfer.getData('text/html');
/**
* If EditorJS json is passed, insert it
*/
if (editorJSData) {
try {
this.insertEditorJSData(JSON.parse(editorJSData));
return;
} catch (e) {} // Do nothing and continue execution as usual if error appears
}
/**
* If text was drag'n'dropped, wrap content with P tag to insert it as the new Block
*/
@ -211,9 +227,9 @@ export default class Paste extends Module {
const isCurrentBlockInitial = BlockManager.currentBlock && Tools.isInitial(BlockManager.currentBlock.tool);
const needToReplaceCurrentBlock = isCurrentBlockInitial && BlockManager.currentBlock.isEmpty;
await Promise.all(dataToInsert.map(
async (content, i) => await this.insertBlock(content, i === 0 && needToReplaceCurrentBlock),
));
dataToInsert.map(
async (content, i) => this.insertBlock(content, i === 0 && needToReplaceCurrentBlock),
);
if (BlockManager.currentBlock) {
Caret.setToBlock(BlockManager.currentBlock, Caret.positions.END);
@ -226,7 +242,7 @@ export default class Paste extends Module {
private setCallback(): void {
const {Listeners} = this.Editor;
Listeners.on(document, 'paste', this.handlePasteEvent);
Listeners.on(this.Editor.UI.nodes.holder, 'paste', this.handlePasteEvent);
}
/**
@ -556,7 +572,7 @@ export default class Paste extends Module {
.map((text) => {
const content = $.make('div');
content.innerHTML = text;
content.textContent = text;
const event = this.composePasteEvent('tag', {
data: content,
@ -625,7 +641,11 @@ export default class Paste extends Module {
if (BlockManager.currentBlock && BlockManager.currentBlock.currentInput) {
const currentToolSanitizeConfig = Sanitizer.getInlineToolsConfig(BlockManager.currentBlock.name);
document.execCommand('insertHTML', false, Sanitizer.clean(content.innerHTML, currentToolSanitizeConfig));
document.execCommand(
'insertHTML',
false,
Sanitizer.clean(content.innerHTML, currentToolSanitizeConfig),
);
} else {
this.insertBlock(dataToInsert);
}
@ -664,12 +684,13 @@ export default class Paste extends Module {
}
/**
* Insert pasted Block content to Editor
*
* @param {PasteData} data
* @param {Boolean} canReplaceCurrentBlock - if true and is current Block is empty, will replace current Block
* @returns {Promise<void>}
* @returns {void}
*/
private async insertBlock(data: PasteData, canReplaceCurrentBlock: boolean = false): Promise<void> {
private insertBlock(data: PasteData, canReplaceCurrentBlock: boolean = false): void {
const {BlockManager, Caret} = this.Editor;
const {currentBlock} = BlockManager;
let block: Block;
@ -685,6 +706,35 @@ export default class Paste extends Module {
Caret.setToBlock(block, Caret.positions.END);
}
/**
* Insert data passed as application/x-editor-js JSON
*
* @param {object} blocks Blocks' data to insert
*
* @return {void}
*/
private insertEditorJSData(blocks: Array<{tool: string, data: BlockToolData}>): void {
const { BlockManager, Tools } = this.Editor;
blocks.forEach(({ tool, data }, i) => {
const settings = this.Editor.Tools.getToolSettings(tool);
let needToReplaceCurrentBlock = false;
if (i === 0) {
const isCurrentBlockInitial = BlockManager.currentBlock && Tools.isInitial(BlockManager.currentBlock.tool);
needToReplaceCurrentBlock = isCurrentBlockInitial && BlockManager.currentBlock.isEmpty;
}
if (needToReplaceCurrentBlock) {
BlockManager.replace(tool, data, settings);
} else {
BlockManager.insert(tool, data, settings);
}
});
}
/**
* Recursively divide HTML string to two types of nodes:
* 1. Block element
@ -719,10 +769,6 @@ export default class Paste extends Module {
case Node.ELEMENT_NODE:
const element = node as HTMLElement;
if (element.tagName === 'BR') {
return [...nodes, destNode, new DocumentFragment()];
}
const {tool = ''} = this.toolsTags[element.tagName] || {};
const toolTags = this.tagsByTool[tool] || [];

View file

@ -131,12 +131,20 @@ export default class RectangleSelection extends Module {
* @param {number} pageY - Y coord of mouse
*/
public startSelection(pageX, pageY) {
this.Editor.BlockSelection.allBlocksSelected = false;
this.clearSelection();
this.stackOfSelected = [];
const elemWhereSelectionStart = document.elementFromPoint(pageX - window.pageXOffset, pageY - window.pageYOffset);
/**
* Don't clear selected block by clicks on the Block settings
* because we need to keep highlighting working block
*/
const startsInsideToolbar = elemWhereSelectionStart.closest(`.${this.Editor.Toolbar.CSS.toolbar}`);
if (!startsInsideToolbar) {
this.Editor.BlockSelection.allBlocksSelected = false;
this.clearSelection();
this.stackOfSelected = [];
}
const selectorsToAvoid = [
`.${Block.CSS.content}`,
`.${this.Editor.Toolbar.CSS.toolbar}`,

View file

@ -204,6 +204,12 @@ export default class Sanitizer extends Module {
});
}
/**
* Allow linebreaks
*/
config['br'] = true;
config['wbr'] = true;
return config;
}

View file

@ -102,6 +102,11 @@ export default class BlockSettings extends Module {
public open(): void {
this.nodes.wrapper.classList.add(this.CSS.wrapperOpened);
/**
* Highlight content of a Block we are working with
*/
this.Editor.BlockManager.currentBlock.selected = true;
/**
* Fill Tool's settings
*/

View file

@ -98,8 +98,6 @@ export default class ConversionToolbar extends Module {
if (typeof togglingCallback === 'function') {
this.togglingCallback = togglingCallback;
this.togglingCallback(this.opened);
}
}

View file

@ -8,12 +8,13 @@ import * as _ from '../../utils';
*
* ______________________________________ Toolbar ____________________________________________
* | |
* | ..................... Content .................... ......... Block Actions .......... |
* | . . . . |
* | . . . [Open Settings] . |
* | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . . |
* | . . . [Settings Panel] . |
* | .................................................. .................................. |
* | ..................... Content ......................................................... |
* | . ........ Block Actions ........... |
* | . . [Open Settings] . |
* | . [Plus Button] [Toolbox: {Tool1}, {Tool2}] . . |
* | . . [Settings Panel] . |
* | . .................................. |
* | ....................................................................................... |
* | |
* |___________________________________________________________________________________________|
*
@ -105,9 +106,14 @@ export default class Toolbar extends Module {
*/
['content', 'actions'].forEach( (el) => {
this.nodes[el] = $.make('div', this.CSS[el]);
$.append(this.nodes.wrapper, this.nodes[el]);
});
/**
* Actions will be included to the toolbar content so we can align in to the right of the content
*/
$.append(this.nodes.wrapper, this.nodes.content);
$.append(this.nodes.content, this.nodes.actions);
/**
* Fill Content Zone:
* - Plus Button
@ -144,7 +150,7 @@ export default class Toolbar extends Module {
*/
this.nodes.blockActionsButtons = $.make('div', this.CSS.blockActionsButtons);
this.nodes.settingsToggler = $.make('span', this.CSS.settingsToggler);
const settingsIcon = $.svg('dots', 18, 4);
const settingsIcon = $.svg('dots', 8, 8);
$.append(this.nodes.settingsToggler, settingsIcon);
$.append(this.nodes.blockActionsButtons, this.nodes.settingsToggler);

View file

@ -431,10 +431,19 @@ export default class InlineToolbar extends Module {
this.Editor.Listeners.on(this.nodes.conversionToggler, 'click', () => {
this.Editor.ConversionToolbar.toggle((conversionToolbarOpened) => {
if (conversionToolbarOpened) {
this.flipper.deactivate();
} else {
/**
* When ConversionToolbar is opening on activated InlineToolbar flipper
* Then we need to temporarily deactivate InlineToolbar flipper so that we could flip ConversionToolbar items
*
* Other case when ConversionToolbar is closing (for example, by escape) but we need to continue flipping
* InlineToolbar items, we activate InlineToolbar flipper
*/
const canActivateInlineToolbarFlipper = !conversionToolbarOpened && this.opened;
if (canActivateInlineToolbarFlipper) {
this.flipper.activate();
} else if (this.opened) {
this.flipper.deactivate();
}
});
});

View file

@ -584,6 +584,21 @@ export default class UI extends Module {
event.stopImmediatePropagation();
event.stopPropagation();
/**
* case when user clicks on anchor element
* if it is clicked via ctrl key, then we open new window with url
*/
const element = event.target as Element;
const ctrlKey = event.metaKey || event.ctrlKey;
if ($.isAnchor(element) && ctrlKey) {
const href = element.getAttribute('href');
const validUrl = _.getValidUrl(href);
_.openTab(validUrl);
return;
}
if (!this.Editor.BlockManager.currentBlock) {
this.Editor.BlockManager.insert();
}

View file

@ -487,3 +487,35 @@ export function beautifyShortcut(shortcut: string): string {
return shortcut;
}
/**
* Returns valid URL. If it is going outside and valid, it returns itself
* If url has `one slash`, then it concatenates with window location origin
* or when url has `two lack` it appends only protocol
*
* @param {String} url
*/
export function getValidUrl(url: string): string {
try {
const urlObject = new URL(url);
return urlObject.href;
} catch (e) {
// do nothing but handle below
}
if (url.substring(0, 2) === '//') {
return window.location.protocol + url;
} else {
return window.location.origin + url;
}
}
/**
* Opens new Tab with passed URL
*
* @param {String} url - URL address to redirect
*/
export function openTab(url: string): void {
window.open(url, '_blank');
}

View file

@ -3,18 +3,6 @@
margin-top: 0;
}
&--focused {
background-image: linear-gradient(17deg, rgba(243, 248, 255, 0.03) 63.45%, rgba(207, 214, 229, 0.27) 98%);
border-radius: 3px;
@media (--mobile){
background-image: none;
background-color: rgba(200, 199, 219, 0.17);
margin: 0 -10px;
padding: 0 10px;
}
}
&--selected &__content {
background: var(--selectionColor);
@ -89,7 +77,6 @@
}
}
.codex-editor--narrow .ce-block--focused {
@media (--not-mobile) {
margin-right: calc(var(--narrow-mode-right-padding) * -1);

View file

@ -1,11 +1,13 @@
.ce-settings {
@apply --overlay-pane;
right: 5px;
top: 35px;
right: -1px;
top: 30px;
min-width: 114px;
box-sizing: content-box;
@media (--mobile){
bottom: 50px;
bottom: 40px;
right: -11px;
top: auto;
}

View file

@ -32,7 +32,7 @@
display: flex;
align-content: center;
margin: 0;
max-width: calc(100% - 40px);
max-width: calc(100% - 35px);
}
}
@ -72,15 +72,15 @@
*/
&__actions {
position: absolute;
right: 0;
top: 10px;
padding-right: 16px;
right: -30px;
top: 5px;
opacity: 0;
@media (--mobile){
position: static;
margin-left: auto;
padding-right: 10px;
position: absolute;
right: -28px;
top: 50%;
transform: translateY(-50%);
display: flex;
align-items: center;
}
@ -95,11 +95,22 @@
}
&__settings-btn {
display: inline-block;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
color: var(--grayText);
cursor: pointer;
background: var(--bg-light);
&:hover {
color: var(--color-dark);
}
@media (--mobile){
background: transparent;
}
}
}

View file

@ -18,6 +18,11 @@
*/
--grayText: #707684;
/**
* Gray icons hover
*/
--color-dark: #1D202B;
/**
* Blue icons
*/

View file

@ -33,9 +33,17 @@ export interface Blocks {
* Swaps two Blocks
* @param {number} fromIndex - block to swap
* @param {number} toIndex - block to swap with
* @deprecated use 'move' instead
*/
swap(fromIndex: number, toIndex: number): void;
/**
* Moves a block to a new index
* @param {number} toIndex - index where the block is moved to
* @param {number} fromIndex - block to move
*/
move(toIndex: number, fromIndex?: number): void;
/**
* Returns Block holder by Block index
* @param {number} index

View file

@ -1,5 +1,5 @@
import {ToolConstructable, ToolSettings} from '../tools';
import {LogLevels, OutputData} from '../index';
import {LogLevels, OutputData, API} from '../index';
import {SanitizerConfig} from './sanitizer-config';
export interface EditorConfig {
@ -69,6 +69,7 @@ export interface EditorConfig {
/**
* Fires when something changed in DOM
* @param {API} api - editor.js api
*/
onChange?(): void;
onChange?(api: API): void;
}

View file

@ -1,9 +1,10 @@
import {ConversionConfig, PasteConfig, SanitizerConfig} from '../configs';
import {BlockToolData} from './block-tool-data';
import {BaseTool, BaseToolConstructable} from './tool';
import {ToolConfig} from './tool-config';
import {API} from '../index';
import {PasteEvent} from './paste-events';
import { ConversionConfig, PasteConfig, SanitizerConfig } from '../configs';
import { BlockToolData } from './block-tool-data';
import { BaseTool, BaseToolConstructable } from './tool';
import { ToolConfig } from './tool-config';
import { API } from '../index';
import { PasteEvent } from './paste-events';
import { MoveEvent } from './hook-events';
/**
* Describe Block Tool object
* @see {@link docs/tools.md}
@ -65,6 +66,11 @@ export interface BlockTool extends BaseTool {
* Called after block removed from the page but before instance is deleted
*/
removed?(): void;
/**
* Called after block was moved
*/
moved?(event: MoveEvent): void;
}
export interface BlockToolConstructable extends BaseToolConstructable {
@ -97,5 +103,5 @@ export interface BlockToolConstructable extends BaseToolConstructable {
* @constructor
* @return {BlockTool}
*/
new (config: {api: API, config: ToolConfig, data: BlockToolData}): BlockTool;
new(config: { api: API, config: ToolConfig, data: BlockToolData }): BlockTool;
}

23
types/tools/hook-events.d.ts vendored Normal file
View file

@ -0,0 +1,23 @@
/**
* Event detail for block relocation
*/
export interface MoveEventDetail {
/**
* index the block was moved from
*/
fromIndex: number;
/**
* index the block was moved to
*/
toIndex: number;
}
/**
* Move event for block relocation
*/
export interface MoveEvent extends CustomEvent {
/**
* Override detail property of CustomEvent by MoveEvent hook
*/
readonly detail: MoveEventDetail;
}

View file

@ -9,6 +9,7 @@ export * from './tool';
export * from './tool-config';
export * from './tool-settings';
export * from './paste-events';
export * from './hook-events';
export type Tool = BaseTool | BlockTool | InlineTool;
export type ToolConstructable = BaseToolConstructable | BlockToolConstructable | InlineToolConstructable;

View file

@ -898,8 +898,8 @@ acorn-jsx@^5.1.0:
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.1.0.tgz#294adb71b57398b0680015f0a38c563ee1db5384"
acorn@^6.2.1:
version "6.4.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.0.tgz#b659d2ffbafa24baf5db1cdbb2c94a983ecd2784"
version "6.4.1"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.1.tgz#531e58ba3f51b9dacb9a6646ca4debf5b14ca474"
acorn@^7.1.0:
version "7.1.0"