Browse Source
Fix matches in sorter (#6750)
* Cleanup old matches usage
* Avoid crashes on matches. Fixes #6748
release-v0.22.16-rc.0
Artur Arseniev
2 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
3 additions and
9 deletions
-
packages/core/package.json
-
packages/core/src/utils/mixins.ts
-
packages/core/src/utils/sorter/SorterUtils.ts
|
|
|
@ -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", |
|
|
|
|
|
|
|
@ -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, |
|
|
|
|
|
|
|
@ -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); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
|