Skip to content

Commit

Permalink
Try separate build modules
Browse files Browse the repository at this point in the history
  • Loading branch information
xdan committed Jun 28, 2022
1 parent 3b642d6 commit ee50c87
Show file tree
Hide file tree
Showing 170 changed files with 796 additions and 803 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ test.html
test.html
tsdoc.json
webpack.config.js
**/*.md
.*.test.js
4 changes: 1 addition & 3 deletions make.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
module.exports = {
paths: [
'./src/plugins/speech/speech-recognize/'
]
paths: ['./src/plugins/speech-recognize/']
};
678 changes: 357 additions & 321 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@
"homepage": "https://xdsoft.net/jodit/",
"dependencies": {
"autobind-decorator": "^2.4.0",
"core-js": "^3.22.8"
"core-js": "^3.23.3"
},
"devDependencies": {
"@types/ace": "^0.0.48",
"@types/node": "^17.0.41",
"@typescript-eslint/eslint-plugin": "^5.27.1",
"@typescript-eslint/parser": "^5.27.1",
"@types/node": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.30.0",
"autoprefixer": "^10.4.7",
"axios": "^0.27.2",
"chai": "^4.3.6",
Expand All @@ -74,53 +74,53 @@
"cross-env": "^7.0.3",
"css-loader": "^6.7.1",
"css-minimizer-webpack-plugin": "^4.0.0",
"cssnano-preset-advanced": "^5.3.7",
"cssnano-preset-advanced": "^5.3.8",
"es6-promise": "^4.2.8",
"eslint": "^8.17.0",
"eslint": "^8.18.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-prettier": "^4.1.0",
"eslint-plugin-tsdoc": "^0.2.16",
"express": "^4.18.1",
"file-loader": "^6.2.0",
"glob": "^8.0.3",
"husky": "^8.0.1",
"karma": "^6.3.20",
"karma": "^6.4.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^3.1.1",
"karma-firefox-launcher": "^2.1.2",
"karma-mocha": "^2.0.1",
"karma-sourcemap-loader": "^0.3.8",
"karma-webpack": "^5.0.0",
"less": "^4.1.2",
"less": "^4.1.3",
"less-loader": "^11.0.0",
"lint-staged": "^13.0.0",
"lint-staged": "^13.0.3",
"merge-stream": "^2.0.0",
"mini-css-extract-plugin": "^2.6.0",
"mini-css-extract-plugin": "^2.6.1",
"mocha": "^10.0.0",
"open": "^8.4.0",
"postcss": ">=8.4.14",
"postcss-css-variables": "^0.18.0",
"postcss-less": "^6.0.0",
"postcss-loader": "^7.0.0",
"prettier": "^2.6.2",
"prettier": "^2.7.1",
"raw-loader": "^4.0.2",
"style-loader": "^3.3.1",
"stylelint": "^14.8.5",
"stylelint": "^14.9.1",
"stylelint-config-idiomatic-order": "v8.1.0",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-standard": "^25.0.0",
"stylelint-config-standard": "^26.0.0",
"stylelint-prettier": "^2.0.0",
"synchronous-promise": "^2.0.15",
"terser-webpack-plugin": "^5.3.3",
"ts-loader": "^9.3.0",
"ts-loader": "^9.3.1",
"ts-private-uglifier": "^1.0.2",
"tslib": "^2.4.0",
"typescript": "^4.7.3",
"typescript": "^4.7.4",
"url-loader": "^4.1.1",
"webpack": "^5.73.0",
"webpack-cli": "^4.9.2",
"webpack-cli": "^4.10.0",
"webpack-dev-middleware": "^5.3.3",
"webpack-dev-server": "^4.9.2",
"webpack-hot-middleware": "^2.25.1",
Expand Down
48 changes: 48 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,54 @@ export class Config implements IViewOptions {
*/
safeMode: boolean = false;

/**
* Editor's width
*
* @example
* ```javascript
* Jodit.make('.editor', {
* width: '100%',
* })
* ```
* @example
* ```javascript
* Jodit.make('.editor', {
* width: 600, // equivalent for '600px'
* })
* ```
* @example
* ```javascript
* Jodit.make('.editor', {
* width: 'auto', // autosize
* })
* ```
*/
width: number | string = 'auto';

/**
* Editor's height
*
* @example
* ```javascript
* Jodit.make('.editor', {
* height: '100%',
* })
* ```
* @example
* ```javascript
* Jodit.make('.editor', {
* height: 600, // equivalent for '600px'
* })
* ```
* @example
* ```javascript
* Jodit.make('.editor', {
* height: 'auto', // default - autosize
* })
* ```
*/
height: number | string = 'auto';

/**
* List of plugins that will be initialized in safe mode.
*
Expand Down
34 changes: 34 additions & 0 deletions src/core/dom/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
$$,
asArray,
attr,
call,
css,
dataBind,
error,
Expand Down Expand Up @@ -698,6 +699,39 @@ export class Dom {
return sibling && cond(sibling) ? sibling : null;
}

/**
* Returns the nearest non-empty sibling
*/
static findNotEmptySibling(node: Node, backspace: boolean): Nullable<Node> {
return Dom.findSibling(node, backspace, n => {
return (
!Dom.isEmptyTextNode(n) &&
Boolean(
!Dom.isText(n) || (n.nodeValue?.length && trim(n.nodeValue))
)
);
});
}

/**
* Returns the nearest non-empty neighbor
*/
static findNotEmptyNeighbor(
node: Node,
left: boolean,
root: HTMLElement
): Nullable<Node> {
return call(
left ? Dom.prev : Dom.next,
node,
n =>
Boolean(
n && (!Dom.isText(n) || trim(n?.nodeValue || '').length)
),
root
);
}

static sibling(node: Node, left?: boolean): Nullable<Node> {
return left ? node.previousSibling : node.nextSibling;
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,26 @@
*/

/**
* @module plugins/keyboard/backspace
* @module plugins/backspace
*/

import type { IJodit } from 'jodit/types';
import { Plugin } from 'jodit/core/plugin';
import { Dom } from 'jodit/core/dom';
import { INVISIBLE_SPACE } from 'jodit/core/constants';
import { isFunction, trim } from 'jodit/core/helpers';
import { cases } from './cases';
import { moveNodeInsideStart } from 'jodit/src/core/selection/helpers';

import type { DeleteMode } from './interface';
import { cases } from './cases';
import { checkNotCollapsed } from './cases/check-not-collapsed';

import './config';
import { moveNodeInsideStart } from 'jodit/src/core/selection/helpers';

export class Backspace extends Plugin {
/** @override */
export class backspace extends Plugin {
override requires = ['hotkeys'];

/** @override */
protected afterInit(jodit: IJodit): void {
protected override afterInit(jodit: IJodit): void {
jodit.e.on('afterCommand.delete', (command: 'delete' | string) => {
if (command === 'delete') {
this.afterDeleteCommand();
Expand Down Expand Up @@ -71,8 +70,7 @@ export class Backspace extends Plugin {
});
}

/** @override */
protected beforeDestruct(jodit: IJodit): void {
protected override beforeDestruct(jodit: IJodit): void {
jodit.e.off('afterCommand.delete');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/

/**
* @module plugins/backspace
*/

import type { IJodit, Nullable } from 'jodit/types';
import { findNotEmptySibling } from 'jodit/plugins/keyboard/helpers';
import { Dom } from 'jodit/core/dom';
import { Dom } from 'jodit/core/dom/dom';

/**
* Check if two separate elements can be connected
Expand All @@ -22,7 +25,7 @@ export function checkJoinNeighbors(
// Find main big closest element
while (
nextBox &&
!findNotEmptySibling(nextBox, backspace) &&
!Dom.findNotEmptySibling(nextBox, backspace) &&
nextBox.parentElement !== jodit.editor
) {
nextBox = nextBox.parentElement;
Expand All @@ -33,7 +36,7 @@ export function checkJoinNeighbors(
Dom.isElement(mainClosestBox) &&
Dom.isContentEditable(mainClosestBox, jodit.editor)
) {
const sibling = findNotEmptySibling(
const sibling = Dom.findNotEmptySibling(
mainClosestBox,
backspace
) as Nullable<Element>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/

/**
* @module plugins/backspace
*/

import type { IJodit } from 'jodit/types';
import { Dom } from '../../../../core/dom';
import { call } from '../../../../core/helpers';
import { Dom } from 'jodit/core/dom/dom';
import { call } from 'jodit/core/helpers/utils/utils';

/**
* Try join two UL elements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/

/**
* @module plugins/backspace
*/

import type { IJodit } from 'jodit/types';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/

/**
* @module plugins/backspace
*/

import type { CanUndef, IJodit, Nullable } from 'jodit/types';
import type { DeleteMode } from 'jodit/plugins/keyboard/backspace/interface';
import { findMostNestedNeighbor } from 'jodit/plugins/keyboard/helpers';
import { Dom } from 'jodit/core/dom';
import { call, isVoid, toArray, trimInv } from 'jodit/core/helpers';
import { INVISIBLE_SPACE, NBSP_SPACE } from 'jodit/core/constants';

import type { DeleteMode } from '../interface';
import { findMostNestedNeighbor } from '../helpers';

/**
* Check possibility the char can be removed
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/

/**
* @module plugins/backspace
*/

import type { IJodit } from 'jodit/types';
import { Dom } from 'jodit/core/dom';
import { call } from 'jodit/core/helpers';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/

/**
* @module plugins/backspace
*/

import type { IJodit } from 'jodit/types';
import { Dom } from 'jodit/core/dom';
import { findNotEmptySibling } from 'jodit/plugins/keyboard/helpers';
import { Dom } from 'jodit/core/dom/dom';

/**
* Check if it is possible to remove an empty adjacent element.
Expand All @@ -32,7 +35,7 @@ export function checkRemoveEmptyNeighbor(
return false;
}

const neighbor = findNotEmptySibling(parent, backspace);
const neighbor = Dom.findNotEmptySibling(parent, backspace);

if (neighbor && Dom.isEmpty(neighbor)) {
Dom.safeRemove(neighbor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/

/**
* @module plugins/backspace
*/

import type { IJodit, Nullable } from 'jodit/types';
import { Dom } from 'jodit/core/dom';
import { findNotEmptyNeighbor } from 'jodit/plugins/keyboard/helpers';
import { INSEPARABLE_TAGS } from 'jodit/core/constants';
import { checkJoinTwoLists } from 'jodit/plugins/keyboard/backspace/cases/check-join-two-lists';

import { findNotEmptyNeighbor } from '../helpers';
import { checkJoinTwoLists } from './check-join-two-lists';

/**
* Check if the current empty item can be removed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
* Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/

/**
* @module plugins/backspace
*/

import type { IJodit } from 'jodit/types';
import { Dom } from '../../../../core/dom';
import { INSEPARABLE_TAGS } from '../../../../core/constants';
import { Dom } from 'jodit/core/dom/dom';
import { INSEPARABLE_TAGS } from 'jodit/core/constants';

import { checkRemoveEmptyParent } from './check-remove-empty-parent';

/**
Expand Down
Loading

0 comments on commit ee50c87

Please sign in to comment.