Browse Source

Cleanup old matches usage

fix-sorter-matches
Artur Arseniev 3 weeks ago
parent
commit
97dba4b3cc
  1. 4
      packages/core/package.json
  2. 5
      packages/core/src/utils/mixins.ts
  3. 3
      packages/core/src/utils/sorter/SorterUtils.ts

4
packages/core/package.json

@ -69,8 +69,8 @@
"scripts": {
"build": "npm run build-all",
"build-all": "run-s build:*",
"build:js": "node node_modules/grapesjs-cli/dist/cli.js build --patch=false --targets=\"> 1%, ie 11, safari 8, not dead\" --statsOutput=\"stats.json\" --localePath=\"src/i18n/locale\"",
"build:mjs": "cross-env BUILD_MODULE=true node node_modules/grapesjs-cli/dist/cli.js build --dts='skip' --patch=false --targets=\"> 1%, ie 11, safari 8, not dead\"",
"build:js": "node node_modules/grapesjs-cli/dist/cli.js build --patch=false --targets=\"defaults\" --statsOutput=\"stats.json\" --localePath=\"src/i18n/locale\"",
"build:mjs": "cross-env BUILD_MODULE=true node node_modules/grapesjs-cli/dist/cli.js build --dts='skip' --patch=false --targets=\"defaults\"",
"build:css": "sass src/styles/scss/main.scss dist/css/grapes.min.css --no-source-map --style=compressed --load-path=node_modules",
"ts:build": "node node_modules/grapesjs-cli/dist/cli.js build --dts='only' --patch=false",
"ts:check": "tsc --noEmit --esModuleInterop dist/index.d.ts",

5
packages/core/src/utils/mixins.ts

@ -85,10 +85,6 @@ export const getGlobal = () =>
export const toLowerCase = (str: string) => (str || '').toLowerCase();
const elProt = hasWin() ? window.Element.prototype : {};
// @ts-ignore
const matches = elProt.matches || elProt.webkitMatchesSelector || elProt.mozMatchesSelector || elProt.msMatchesSelector;
export const getUiClass = (em: EditorModel, defCls: string) => {
const { stylePrefix, customUI } = em.getConfig();
return [customUI && `${stylePrefix}cui`, defCls].filter((i) => i).join(' ');
@ -315,7 +311,6 @@ export const buildBase64UrlFromSvg = (svg: string) => {
export {
hasDnd,
upFirst,
matches,
getModel,
camelCase,
getElement,

3
packages/core/src/utils/sorter/SorterUtils.ts

@ -1,7 +1,6 @@
import { $, Model, SetOptions } from '../../common';
import EditorModel from '../../editor/model/Editor';
import { isTextNode } from '../dom';
import { matches as matchesMixin } from '../mixins';
import { SortableTreeNode } from './SortableTreeNode';
import { Placement, DragDirection, SorterOptions } from './types';
import Dimension from './Dimension';
@ -86,7 +85,7 @@ export function offset(el: HTMLElement) {
* @return {Boolean}
*/
export function matches(el: HTMLElement, selector: string): boolean {
return matchesMixin.call(el, selector);
return el.matches(selector);
}
/**

Loading…
Cancel
Save