Skip to content

Commit

Permalink
Merge branch 'next' into angus/upstream-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
neSpecc authored Sep 10, 2024
2 parents e963880 + 8f365f0 commit 7019073
Show file tree
Hide file tree
Showing 132 changed files with 790 additions and 481 deletions.
21 changes: 19 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@
"navigator": true
},
"rules": {
"jsdoc/require-returns-type": "off"
}
"jsdoc/require-returns-type": "off",
"@typescript-eslint/strict-boolean-expressions": "warn",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/consistent-type-exports": "error"
},
"overrides": [
{
"files": [
"tsconfig.json",
"package.json",
"tsconfig.*.json",
"tslint.json"
],
"rules": {
"quotes": [1, "double"],
"semi": [1, "never"],
}
}
]
}
8 changes: 6 additions & 2 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { defineConfig } from 'cypress';
import path from 'node:path';
import vitePreprocessor from 'cypress-vite';

export default defineConfig({
env: {
Expand All @@ -12,7 +14,9 @@ export default defineConfig({
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
on('file:preprocessor', require('cypress-vite')(config));
on('file:preprocessor', vitePreprocessor({
configFile: path.resolve(__dirname, './vite.config.test.js'),
}));

/**
* Plugin for cypress that adds better terminal output for easier debugging.
Expand All @@ -21,7 +25,7 @@ export default defineConfig({
*/
require('cypress-terminal-report/src/installLogsPrinter')(on);

require('./test/cypress/plugins/index.ts')(on, config);
require('@cypress/code-coverage/task')(on, config);
},
specPattern: 'test/cypress/tests/**/*.cy.{js,jsx,ts,tsx}',
supportFile: 'test/cypress/support/index.ts',
Expand Down
8 changes: 8 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

### 2.30.5

`Fix` – Fix exported types

### 2.30.4

- `Fix` - Tool's exporting types added

### 2.30.3

- `Fix` – I18n in nested popover
Expand Down
2 changes: 1 addition & 1 deletion example/tools/nested-list
2 changes: 1 addition & 1 deletion example/tools/text-variant-tune
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@editorjs/editorjs",
"version": "2.30.3",
"version": "2.30.5",
"description": "Editor.js — open source block-style WYSIWYG editor with JSON output",
"main": "dist/editorjs.umd.js",
"module": "dist/editorjs.mjs",
Expand Down Expand Up @@ -40,20 +40,20 @@
},
"devDependencies": {
"@babel/register": "^7.21.0",
"@codexteam/icons": "^0.3.0",
"@codexteam/icons": "0.3.2",
"@codexteam/shortcuts": "^1.1.1",
"@cypress/code-coverage": "^3.10.3",
"@editorjs/code": "^2.7.0",
"@editorjs/delimiter": "^1.2.0",
"@editorjs/header": "^2.7.0",
"@editorjs/header": "^2.8.7",
"@editorjs/paragraph": "^2.11.6",
"@editorjs/simple-image": "^1.4.1",
"@types/node": "^18.15.11",
"chai-subset": "^1.6.0",
"codex-notifier": "^1.1.2",
"codex-tooltip": "^1.0.5",
"core-js": "3.30.0",
"cypress": "^13.7.1",
"cypress": "^13.13.3",
"cypress-intellij-reporter": "^0.0.7",
"cypress-plugin-tab": "^1.0.5",
"cypress-terminal-report": "^5.3.2",
Expand Down
2 changes: 1 addition & 1 deletion src/codex.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

import { EditorConfig } from '../types';
import type { EditorConfig } from '../types';

/**
* Apply polyfills
Expand Down
10 changes: 5 additions & 5 deletions src/components/__module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { EditorModules } from '../types-internal/editor-modules';
import { EditorConfig } from '../../types';
import { ModuleConfig } from '../types-internal/module-config';
import type { EditorModules } from '../types-internal/editor-modules';
import type { EditorConfig } from '../../types';
import type { ModuleConfig } from '../types-internal/module-config';
import Listeners from './utils/listeners';
import EventsDispatcher from './utils/events';
import { EditorEventMap } from './events';
import type EventsDispatcher from './utils/events';
import type { EditorEventMap } from './events';

/**
* The type <T> of the Module generic.
Expand Down
4 changes: 2 additions & 2 deletions src/components/block-tunes/block-tune-delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* @classdesc Editor's default tune that moves up selected block
* @copyright <CodeX Team> 2018
*/
import { API, BlockTune } from '../../../types';
import type { API, BlockTune } from '../../../types';
import { IconCross } from '@codexteam/icons';
import { MenuConfig } from '../../../types/tools/menu-config';
import type { MenuConfig } from '../../../types/tools/menu-config';

/**
*
Expand Down
4 changes: 2 additions & 2 deletions src/components/block-tunes/block-tune-move-down.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* @copyright <CodeX Team> 2018
*/

import { API, BlockTune } from '../../../types';
import type { API, BlockTune } from '../../../types';
import { IconChevronDown } from '@codexteam/icons';
import { TunesMenuConfig } from '../../../types/tools';
import type { TunesMenuConfig } from '../../../types/tools';


/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/block-tunes/block-tune-move-up.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* @classdesc Editor's default tune that moves up selected block
* @copyright <CodeX Team> 2018
*/
import { API, BlockTune } from '../../../types';
import type { API, BlockTune } from '../../../types';
import { IconChevronUp } from '@codexteam/icons';
import { TunesMenuConfig } from '../../../types/tools';
import type { TunesMenuConfig } from '../../../types/tools';

/**
*
Expand Down
8 changes: 4 additions & 4 deletions src/components/block/api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Block from './index';
import { BlockToolData, ToolConfig, ToolboxConfigEntry } from '../../../types/tools';
import { SavedData } from '../../../types/data-formats';
import { BlockAPI as BlockAPIInterface } from '../../../types/api';
import type Block from './index';
import type { BlockToolData, ToolConfig, ToolboxConfigEntry } from '../../../types/tools';
import type { SavedData } from '../../../types/data-formats';
import type { BlockAPI as BlockAPIInterface } from '../../../types/api';

/**
* Constructs new BlockAPI object
Expand Down
31 changes: 16 additions & 15 deletions src/components/block/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
BlockAPI as BlockAPIInterface,
BlockTool as IBlockTool,
BlockToolData,
Expand All @@ -9,24 +9,25 @@ import {
PopoverItemParams
} from '../../../types';

import { SavedData } from '../../../types/data-formats';
import type { SavedData } from '../../../types/data-formats';
import $, { toggleEmptyMark } from '../dom';
import * as _ from '../utils';
import ApiModules from '../modules/api';
import type ApiModules from '../modules/api';
import BlockAPI from './api';
import SelectionUtils from '../selection';
import BlockTool from '../tools/block';
import type BlockToolAdapter from '../tools/block';

import BlockTune from '../tools/tune';
import { BlockTuneData } from '../../../types/block-tunes/block-tune-data';
import ToolsCollection from '../tools/collection';
import type BlockTuneAdapter from '../tools/tune';
import type { BlockTuneData } from '../../../types/block-tunes/block-tune-data';
import type ToolsCollection from '../tools/collection';
import EventsDispatcher from '../utils/events';
import { TunesMenuConfigItem } from '../../../types/tools';
import type { TunesMenuConfigItem } from '../../../types/tools';
import { isMutationBelongsToElement } from '../utils/mutations';
import { EditorEventMap, FakeCursorAboutToBeToggled, FakeCursorHaveBeenSet, RedactorDomChanged } from '../events';
import { RedactorDomChangedPayload } from '../events/RedactorDomChanged';
import type { EditorEventMap } from '../events';
import { FakeCursorAboutToBeToggled, FakeCursorHaveBeenSet, RedactorDomChanged } from '../events';
import type { RedactorDomChangedPayload } from '../events/RedactorDomChanged';
import { convertBlockDataToString, isSameBlockData } from '../utils/blocks';
import { PopoverItemType } from '../utils/popover';
import { PopoverItemType } from '@/types/utils/popover/popover-item-type';

/**
* Interface describes Block class constructor argument
Expand All @@ -45,7 +46,7 @@ interface BlockConstructorOptions {
/**
* Tool object
*/
tool: BlockTool;
tool: BlockToolAdapter;

/**
* Editor's API methods
Expand Down Expand Up @@ -130,7 +131,7 @@ export default class Block extends EventsDispatcher<BlockEvents> {
/**
* Instance of the Tool Block represents
*/
public readonly tool: BlockTool;
public readonly tool: BlockToolAdapter;

/**
* User Tool configuration
Expand All @@ -145,7 +146,7 @@ export default class Block extends EventsDispatcher<BlockEvents> {
/**
* Tunes used by Tool
*/
public readonly tunes: ToolsCollection<BlockTune>;
public readonly tunes: ToolsCollection<BlockTuneAdapter>;

/**
* Tool's user configuration
Expand Down Expand Up @@ -233,7 +234,7 @@ export default class Block extends EventsDispatcher<BlockEvents> {
this.toolInstance = tool.create(data, this.blockAPI, readOnly);

/**
* @type {BlockTune[]}
* @type {BlockTuneAdapter[]}
*/
this.tunes = tool.tunes;

Expand Down
5 changes: 3 additions & 2 deletions src/components/blocks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as _ from './utils';
import $ from './dom';
import Block, { BlockToolAPI } from './block';
import { MoveEvent } from '../../types/tools';
import type Block from './block';
import { BlockToolAPI } from './block';
import type { MoveEvent } from '../../types/tools';

/**
* @class Blocks
Expand Down
6 changes: 3 additions & 3 deletions src/components/core.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import $ from './dom';
import * as _ from './utils';
import { EditorConfig, SanitizerConfig } from '../../types';
import { EditorModules } from '../types-internal/editor-modules';
import type { EditorConfig, SanitizerConfig } from '../../types';
import type { EditorModules } from '../types-internal/editor-modules';
import I18n from './i18n';
import { CriticalError } from './errors/critical';
import EventsDispatcher from './utils/events';
import Modules from './modules';
import { EditorEventMap } from './events';
import type { EditorEventMap } from './events';

/**
* Editor.js core class. Bootstraps modules.
Expand Down
2 changes: 1 addition & 1 deletion src/components/events/BlockChanged.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BlockMutationEvent } from '../../../types/events/block';
import type { BlockMutationEvent } from '../../../types/events/block';

/**
* Fired when some block state has changed
Expand Down
17 changes: 11 additions & 6 deletions src/components/events/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { RedactorDomChanged, RedactorDomChangedPayload } from './RedactorDomChanged';
import { BlockChanged, BlockChangedPayload } from './BlockChanged';
import { BlockHovered, BlockHoveredPayload } from './BlockHovered';
import { FakeCursorAboutToBeToggled, FakeCursorAboutToBeToggledPayload } from './FakeCursorAboutToBeToggled';
import { FakeCursorHaveBeenSet, FakeCursorHaveBeenSetPayload } from './FakeCursorHaveBeenSet';
import { EditorMobileLayoutToggled, EditorMobileLayoutToggledPayload } from './EditorMobileLayoutToggled';
import type { RedactorDomChangedPayload } from './RedactorDomChanged';
import { RedactorDomChanged } from './RedactorDomChanged';
import type { BlockChangedPayload } from './BlockChanged';
import { BlockChanged } from './BlockChanged';
import type { BlockHovered, BlockHoveredPayload } from './BlockHovered';
import type { FakeCursorAboutToBeToggledPayload } from './FakeCursorAboutToBeToggled';
import { FakeCursorAboutToBeToggled } from './FakeCursorAboutToBeToggled';
import type { FakeCursorHaveBeenSetPayload } from './FakeCursorHaveBeenSet';
import { FakeCursorHaveBeenSet } from './FakeCursorHaveBeenSet';
import type { EditorMobileLayoutToggledPayload } from './EditorMobileLayoutToggled';
import { EditorMobileLayoutToggled } from './EditorMobileLayoutToggled';

/**
* Events fired by Editor Event Dispatcher
Expand Down
4 changes: 2 additions & 2 deletions src/components/i18n/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import defaultDictionary from './locales/en/messages.json';
import { I18nDictionary, Dictionary } from '../../../types/configs';
import { LeavesDictKeys } from '../../types-internal/i18n-internal-namespace';
import type { I18nDictionary, Dictionary } from '../../../types/configs';
import type { LeavesDictKeys } from '../../types-internal/i18n-internal-namespace';

/**
* Type for all available internal dictionary strings
Expand Down
2 changes: 1 addition & 1 deletion src/components/i18n/namespace-internal.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import defaultDictionary from './locales/en/messages.json';
import { DictNamespaces } from '../../types-internal/i18n-internal-namespace';
import type { DictNamespaces } from '../../types-internal/i18n-internal-namespace';
import { isObject, isString } from '../utils';

/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/inline-tools/inline-tool-bold.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { InlineTool, SanitizerConfig } from '../../../types';
import type { InlineTool, SanitizerConfig } from '../../../types';
import { IconBold } from '@codexteam/icons';
import { MenuConfig } from '../../../types/tools';
import type { MenuConfig } from '../../../types/tools';

/**
* Bold Tool
Expand Down
6 changes: 3 additions & 3 deletions src/components/inline-tools/inline-tool-convert.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { IconReplace } from '@codexteam/icons';
import { InlineTool, API } from '../../../types';
import { MenuConfig, MenuConfigItem } from '../../../types/tools';
import type { InlineTool, API } from '../../../types';
import type { MenuConfig, MenuConfigItem } from '../../../types/tools';
import * as _ from '../utils';
import { Blocks, Selection, Tools, Caret, I18n } from '../../../types/api';
import type { Blocks, Selection, Tools, Caret, I18n } from '../../../types/api';
import SelectionUtils from '../selection';
import { getConvertibleToolsForBlock } from '../utils/blocks';
import I18nInternal from '../i18n';
Expand Down
2 changes: 1 addition & 1 deletion src/components/inline-tools/inline-tool-italic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InlineTool, SanitizerConfig } from '../../../types';
import type { InlineTool, SanitizerConfig } from '../../../types';
import { IconItalic } from '@codexteam/icons';

/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/inline-tools/inline-tool-link.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SelectionUtils from '../selection';
import * as _ from '../utils';
import { InlineTool, SanitizerConfig, API } from '../../../types';
import { Notifier, Toolbar, I18n, InlineToolbar } from '../../../types/api';
import type { InlineTool, SanitizerConfig, API } from '../../../types';
import type { Notifier, Toolbar, I18n, InlineToolbar } from '../../../types/api';
import { IconLink, IconUnlink } from '@codexteam/icons';

/**
Expand Down
4 changes: 2 additions & 2 deletions src/components/modules/api/blocks.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { BlockAPI as BlockAPIInterface, Blocks } from '../../../../types/api';
import { BlockToolData, OutputBlockData, OutputData, ToolConfig } from '../../../../types';
import type { BlockToolData, OutputBlockData, OutputData, ToolConfig } from '../../../../types';
import * as _ from './../../utils';
import BlockAPI from '../../block/api';
import Module from '../../__module';
import Block from '../../block';
import { capitalize } from '../../utils';
import { BlockTuneData } from '../../../../types/block-tunes/block-tune-data';
import type { BlockTuneData } from '../../../../types/block-tunes/block-tune-data';

/**
* @class BlocksAPI
Expand Down
2 changes: 1 addition & 1 deletion src/components/modules/api/caret.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BlockAPI, Caret } from '../../../../types/api';
import type { BlockAPI, Caret } from '../../../../types/api';
import Module from '../../__module';
import { resolveBlock } from '../../utils/api';

Expand Down
2 changes: 1 addition & 1 deletion src/components/modules/api/events.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Module from '../../__module';
import { Events } from '../../../../types/api';
import type { Events } from '../../../../types/api';

/**
* @class EventsAPI
Expand Down
2 changes: 1 addition & 1 deletion src/components/modules/api/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I18n } from '../../../../types/api';
import type { I18n } from '../../../../types/api';
import I18nInternal from '../../i18n';
import { logLabeled } from '../../utils';
import Module from '../../__module';
Expand Down
Loading

0 comments on commit 7019073

Please sign in to comment.