From 9ad4207112a0959f4a838b636f041094c05822ad Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Mon, 26 Aug 2024 15:59:38 +0400 Subject: [PATCH 1/3] Remove element border reset (#6093) * Remove the border update in handleDrop. Fixes https://github.com/GrapesJS/mjml/issues/338 * Allow custom parser options in component text view `disableEditing` * Format --- src/common/index.ts | 3 +++ src/dom_components/model/Components.ts | 8 ++++---- src/dom_components/types.ts | 5 +++++ src/dom_components/view/ComponentTextView.ts | 4 ++-- src/utils/Droppable.ts | 1 - 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/common/index.ts b/src/common/index.ts index 6f9f74c93..943d4ad02 100644 --- a/src/common/index.ts +++ b/src/common/index.ts @@ -1,4 +1,5 @@ import Backbone from 'backbone'; +import { HTMLParserOptions } from '../parser/config/config'; export { default as $ } from '../utils/cash-dom'; interface NOOP {} @@ -13,6 +14,8 @@ export type DisableOptions = { fromMove?: boolean }; export type LocaleOptions = { locale?: boolean }; +export type WithHTMLParserOptions = { parserOptions?: HTMLParserOptions }; + export type RemoveOptions = Backbone.Silenceable; export type EventHandler = Backbone.EventHandler; diff --git a/src/dom_components/model/Components.ts b/src/dom_components/model/Components.ts index 878ae0b07..452fd30ee 100644 --- a/src/dom_components/model/Components.ts +++ b/src/dom_components/model/Components.ts @@ -1,6 +1,6 @@ import { isEmpty, isArray, isString, isFunction, each, includes, extend, flatten, keys } from 'underscore'; import Component from './Component'; -import { AddOptions, Collection, OptionAsDocument } from '../../common'; +import { AddOptions, Collection } from '../../common'; import { DomComponentsConfig } from '../config/config'; import EditorModel from '../../editor/model/Editor'; import ComponentManager from '..'; @@ -15,7 +15,7 @@ import { } from './types'; import ComponentText from './ComponentText'; import ComponentWrapper from './ComponentWrapper'; -import { ComponentsEvents } from '../types'; +import { ComponentsEvents, ParseStringOptions } from '../types'; import { isSymbolInstance, isSymbolRoot, updateSymbolComps } from './SymbolUtils'; export const getComponentIds = (cmp?: Component | Component[] | Components, res: string[] = []) => { @@ -252,11 +252,11 @@ Component> { return new model(attrs, options) as Component; } - parseString(value: string, opt: AddOptions & OptionAsDocument & { temporary?: boolean; keepIds?: string[] } = {}) { + parseString(value: string, opt: ParseStringOptions = {}) { const { em, domc, parent } = this; const asDocument = opt.asDocument && parent?.is('wrapper'); const cssc = em.Css; - const parsed = em.Parser.parseHtml(value, { asDocument }); + const parsed = em.Parser.parseHtml(value, { asDocument, ...opt.parserOptions }); let components = parsed.html; if (asDocument) { diff --git a/src/dom_components/types.ts b/src/dom_components/types.ts index fbca11658..e62ce1514 100644 --- a/src/dom_components/types.ts +++ b/src/dom_components/types.ts @@ -1,3 +1,4 @@ +import { AddOptions, OptionAsDocument, WithHTMLParserOptions } from '../common'; import Component from './model/Component'; export enum ActionLabelComponents { @@ -16,6 +17,10 @@ export interface SymbolInfo { relatives: Component[]; } +export interface ParseStringOptions extends AddOptions, OptionAsDocument, WithHTMLParserOptions { + keepIds?: string[]; +} + export enum ComponentsEvents { /** * @event `component:add` New component added. diff --git a/src/dom_components/view/ComponentTextView.ts b/src/dom_components/view/ComponentTextView.ts index d67ec3521..8fcd42493 100644 --- a/src/dom_components/view/ComponentTextView.ts +++ b/src/dom_components/view/ComponentTextView.ts @@ -1,5 +1,5 @@ import { bindAll } from 'underscore'; -import { AddOptions, DisableOptions, ObjectAny } from '../../common'; +import { AddOptions, DisableOptions, ObjectAny, WithHTMLParserOptions } from '../../common'; import RichTextEditorModule from '../../rich_text_editor'; import RichTextEditor from '../../rich_text_editor/model/RichTextEditor'; import { off, on } from '../../utils/dom'; @@ -108,7 +108,7 @@ export default class ComponentTextView Date: Mon, 26 Aug 2024 10:35:08 -0700 Subject: [PATCH 2/3] Bump backbone-undo from 0.2.5 to 0.2.6 (#6088) Bumps [backbone-undo](https://github.com/osartun/Backbone.Undo.js) from 0.2.5 to 0.2.6. - [Release notes](https://github.com/osartun/Backbone.Undo.js/releases) - [Commits](https://github.com/osartun/Backbone.Undo.js/compare/0.2.5...v0.2.6) --- updated-dependencies: - dependency-name: backbone-undo dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daniel Starns --- package.json | 2 +- yarn.lock | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 4fec3c264..9d836ab8d 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "dependencies": { "@types/backbone": "1.4.15", "backbone": "1.4.1", - "backbone-undo": "0.2.5", + "backbone-undo": "0.2.6", "codemirror": "5.63.0", "codemirror-formatting": "1.0.0", "promise-polyfill": "8.1.3", diff --git a/yarn.lock b/yarn.lock index 05a385278..54756e9a0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3295,15 +3295,15 @@ babelify@^10.0.0: resolved "https://registry.npmjs.org/babelify/-/babelify-10.0.0.tgz#fe73b1a22583f06680d8d072e25a1e0d1d1d7fb5" integrity sha512-X40FaxyH7t3X+JFAKvb1H9wooWKLRCi8pg3m8poqtdZaIng+bjzp9RvKQCvRjF9isHiPkXspbbXT/zwXLtwgwg== -backbone-undo@0.2.5: - version "0.2.5" - resolved "https://registry.npmjs.org/backbone-undo/-/backbone-undo-0.2.5.tgz#55b25230f90319ca622465e89a80248b893c2ce2" - integrity sha512-fmIFggCqDpQKWj2YlxjipGlKqEKjIrCoee4BnHJoLNflSy4/Rd9T7DVsELJ50CrQctOscdFfB7cGnqncluIthQ== +backbone-undo@0.2.6: + version "0.2.6" + resolved "https://registry.npmjs.org/backbone-undo/-/backbone-undo-0.2.6.tgz#00c4d78ab2425c18a76f2a96a1eee181560a5d8d" + integrity sha512-AsfpNiljLXlk7TcffDUu3EAUq7CxWbyTNwARWrql5XTzN4vh6WzEEBZYaKK4kTTz+iW1tSzqUooaGRIwO83kWA== dependencies: - backbone "1.0.0 - 1.2.1" - underscore "1.4.4 - 1.8.3" + backbone ">=1.0.0" + underscore ">=1.4.4" -"backbone@1.0.0 - 1.2.1", backbone@1.3.3: +backbone@1.3.3, backbone@>=1.0.0: version "1.3.3" resolved "https://registry.npmjs.org/backbone/-/backbone-1.3.3.tgz#4cc80ea7cb1631ac474889ce40f2f8bc683b2999" integrity sha512-aK+k3TiU4tQDUrRCymDDE7XDFnMVuyE6zbZ4JX7mb4pJbQTVOH997/kyBzb8wB2s5Y/Oh7EUfj+sZhwRPxWwow== @@ -13508,7 +13508,7 @@ unc-path-regex@^0.1.2: resolved "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" integrity sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg== -underscore@1.13.1, "underscore@1.4.4 - 1.8.3": +underscore@1.13.1, underscore@>=1.4.4: version "1.13.1" resolved "https://registry.npmjs.org/underscore/-/underscore-1.13.1.tgz#0c1c6bd2df54b6b69f2314066d65b6cde6fcf9d1" integrity sha512-hzSoAVtJF+3ZtiFX0VgfFPHEDRm7Y/QPjGyNo4TVdnDTdft3tr8hEkD25a1jC+TjTuE7tkHGKkhwCgs9dgBB2g== From a73c087f77374796f597969d7eb11f96ca410e03 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Aug 2024 10:41:22 -0700 Subject: [PATCH 3/3] Bump whatwg-fetch from 3.6.2 to 3.6.20 (#6089) Bumps [whatwg-fetch](https://github.com/github/fetch) from 3.6.2 to 3.6.20. - [Release notes](https://github.com/github/fetch/releases) - [Changelog](https://github.com/JakeChampion/fetch/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/fetch/compare/v3.6.2...v3.6.20) --- updated-dependencies: - dependency-name: whatwg-fetch dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Daniel Starns --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 9d836ab8d..b69cbaae9 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "sass": "1.42.1", "typescript": "5.5.4", "vuepress": "1.9.10", - "whatwg-fetch": "3.6.2" + "whatwg-fetch": "3.6.20" }, "resolutions": { "backbone-undo/backbone": "1.3.3", diff --git a/yarn.lock b/yarn.lock index 54756e9a0..3906e9072 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14401,10 +14401,10 @@ whatwg-encoding@^3.1.1: dependencies: iconv-lite "0.6.3" -whatwg-fetch@3.6.2: - version "3.6.2" - resolved "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz#dced24f37f2624ed0281725d51d0e2e3fe677f8c" - integrity sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA== +whatwg-fetch@3.6.20: + version "3.6.20" + resolved "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz#580ce6d791facec91d37c72890995a0b48d31c70" + integrity sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg== whatwg-mimetype@^3.0.0: version "3.0.0"