Releases: GrapesJS/grapesjs
Releases · GrapesJS/grapesjs
v0.15.8
Changed
- Make
config.avoidInlineStyle
true by default
We actually gonna stop to support the old inline-style method so this option will be removed soon - Guarantee the uniqueness of components id
Now if you update the component with the id attribute that already exists, it will rollback to the previous one
Added
- Added
config.styleManager.textLayer
option #2246
Fixed
v0.15.5
Docs
- Update docs for richTextEditor config #2241
Changed
⚠️ Typo fixconfig.wrappesIsBody
->config.wrapperIsBody
@jcamejo #2222- Set
avoidDefaults
true by default - Support objects/arrays in script interpolations #2239
Added
- Added
at
option toaddProperty
method in StyleManager #2213 - Added
config.assetManager.beforeUpload
callback option (thanks to @tliscomb) #2227
Fixed
v0.15.3
Docs
- Updated Traits module page
Changed
⚠️ editor.addComponents
now returns always an array of added components. So, if you ever used its result like this:now it should beconst component = editor.addComponents('<div>...');
const component = editor.addComponents('<div>...')[0];
⚠️ Updated traits layout. If you've ever customized the CSS of your traits you might see something broken- Upgrade to Babel 7
- Recreate view element on
script
prop update - Log a warning in case no sector, in StyleManager, is found #2068
Added
- Added support for components generated from JSX (React preset).
In this way, you can useeditor.addComponents(<div>Hello JSX</div>)
to add components. JSX helps the editor in performances as it skips the parsing of an HTML string but keeps the readability of your code.
If you work in a different framework environment with JSX support (eg. writing JSX in Vue SFC generates another kind of objects) you can use a customprocessor
callback function as an option in theDomComponent
module to transform those objects (quick example from the code). - Added the possibility to specify the position on sector add via API #2094
- Added
draggableComponents
option (defaulttrue
) in DomComponents. This allows moving
components by dragging the component itself (not only by the move icon in the toolbar) - Allow dropping blocks absolutely when the
absolute
mode is active - Added
script-export
property to Component (check the API Reference of the property) - Added
escapeName
option and method in SelectorManager #1703
With this option you can now set a custom name escape strategy on selectors (eg. classes)grapesjs.init({ ... selectorManager: { escapeName: name => name.replace(' ', '___'), }, });
- Added
props
method in Trait and Component - Added new [API for extending Traits] (https://grapesjs.com/docs/modules/Traits.html#define-new-trait-type)
- Added new Drag Mode API for changing drag modes of components in canvas
config.dragMode
- The initial configuration for the global drag modeeditor.setDragMode
- change the global drag mode of componentscomponent.setDragMode
- change the drag mode of a single component
Fixed
v0.14.62
Changed
- Avoid the default form behavior on submit
- Prefer target value first in Select trait
- Remove traits information from component JSON
- Update icon styles in layers and component name editing
- Trigger
component:add
also on inner added components
Added
- Added
media
option to blocks (for icons) - Added
removeType
method inDomComponents
module
Fixed
- Update sortMediaObject to sort CSS correctly also in the mobile first approach #1996
- Fix regression with textable components
- Render attributes for temporary components. Fixes #2010
- Fix drag and drop from outside of the canvas
- Avoid
fetchFile
in temporary image components - Fix unit change in Style manager #2028
- Avoid errors on class status toggle. Closes #2035
- Fix position of the toolbar when is outside of the canvas
- Propagate the extension of new commands to old. #2054
v0.14.61
Docs
Changed
- Avoid scrollIntoView if the element isn't found
- Clean JS from
script
on component remove - Print a warning when trying to use not existing component type
Added
- Added Comment component
- Added
textable
property #481 example - Added
stopCommand
method to all commands - Added
extend
method to the Commands module - Added
findType
,removeTrait
,addTrait
,updateTrait
andgetTraitIndex
methods to Component
For more details about those methods check the Component API Reference - Added options argument to
Editor.select
method
The only available option for now isscroll
, which allows you to scroll the canvas
to the selected component:editor.select(component, { scroll: true })
- Added
appendOnClick
option (defaultfalse
) to Blocks module #1951
This would allow appending blocks also on click, not only by drag & drop - Enable the possibility to accept components as a function
You can easily create components with dynamic default templatesdomc.addType('some-type', { model: { defaults: { label: 'Value for some custom prop', // You can return an HTML string, Component object or // an array which mixes all of them components: component => `<div class="something"> ${this.get('label')} </div>`, } } });
- Improved
addType
in Components module. AddedextendFn
andextendFnView
options.
When you need to reuse functions, of the parent you're extending, generally what you do is this:Now you can do it faster by doing:domc.addType('new-type', { extend: 'parent-type', model: { init() { domc.getType('parent-type').model.prototype.init.apply(this, arguments); // do something; }, } });
The same would be for the view by usingdomc.addType('new-type', { extend: 'parent-type', extendFn: ['init'], // array of model functions to extend model: { init() { // do something; }, } });
extendFnView
Fixed
- Scroll the RTE toolbar if the text component is bigger than the view. Closes #1980
- Fix autosave issue in remote storage. Closes #1985
- Avoid moving styles from Components to Rules. Fixes #1978
- Store the last return of the stateful command
- Make Layers more reliable and generally more aware of textnodes #1949
- Skip rendering for temporary components #1941
- Avoid
undefined
value in select traits - Avoid the default link behavior in the canvas
- Avoid showing in layers not layerable components
Removed
- Removed old deprecated commands: CreateComponent, DeleteComponent, SelectParent
v0.14.57
Changed
- Force stop commands in Panels/ButtonView
- Refactor
preview
command - Make
modal:open
/modal:close
events more reliable - Remove related CSS rules of a removed component
- Update the
textnode
component and make it more compliant to other components - Refactor
DomComponents.clear
method
Added
- Added
run
andstop
events for Commands - Add
onceClose
/onceOpen
methods in Modal module - Add
strict
option in Command module configs #1881 - Add
fetchOptions
for the RemoteStorage. Closes #1885
Fixed
v0.14.55
Changed
- Allow default as a function in component addType
- Add the possibility to preventDefault from
add
method, in Keymaps module ⚠️ Commandsrun
/stop
can't be executed many times in the same state.
So if the command is already active, calling it viaeditor.runCommand
will
not trigger that command again. But in case you need to run the command, in any
way, you can force its execution withforce
:
editor.runCommand('CMD', { force: 1 });
- Avoid duplicate IDs on components
- Refactor TraitSelectVIew and listen options changes
- Ensure default units for devices
- Move ratioDefault option from the Resize command to image component
- Accept
classes
as a string in Component - Refactor
@utils/Resizer
and update its container on text component change - Improve the recognition of stateless commands
- Merge element content in text components before toHTML. Closes #1767
Added
- Added model and property value to the trigger of
change:attributes:ATTR
event - Added the possibility to disable StorageManger with
storageManager: false
(any falsy value is ok) - Custom tag for buttons in Panels module. Closes #1787
- Added the possibility to zoom the canvas via
editor.Canvas.setZoom(VALUE_FROM_0_TO_100)
- Added custom render for blocks. Now you can pass a
render
callback function when you create blocks (Blocks docs updated) - Added
fallback
property to Image component and its default placeholder images - Added
component:type:add
andcomponent:type:update
events to track changes on component types - Added
update
event to generally listen any change to the template (HTML/CSS)
Fixed
- Fixed not working toolbar buttons with Text components. #1567 by @arthuralmeidap
- Ensure default CSS block container. Fixes #1829
- Avoid property breaking in StyleManager without
property
. Fixes #1830 - Reset upload input file in AssetManager. Closes #1816
- Fix empty provider select in the video component traits
- Check protected attribute before removing a tag #1857 by @WebEtSolutions
- Fix scrollIntoView issue in Layers. Closes #1865
Removed
- Removed old commands:
image-comp
,text-comp
,insert-custom
v0.14.52 ⚠️
Docs
- Update broken link in Components. Closes #1689
Changed
⚠️ SetcontentTypeJson
default totrue
(RemoteStorage)- Added
<a>
to defaultnotTextable
option in the Canvas configuration. Closes #1699 - Updated
add
andget
methods in Selector module, now they can receive an array of selectors to add/get - Allow to render blocks container outside by using
external
option. #1716 - Agjust
justify-content
in traits style. Closes #1726 - Adjust component toolbar positioning. #1728 by @arthuralmeidap
- Pass the Editor instance on
load
event - Update classes in SectorView to allow an easier customization. Closes #1753
Added
- Added
autoscrollLimit
option in the Canvas module - Added
credentials
option in the Storage module (for the RemoteStorage) by @arthuralmeidap - Added
modal:open
andmodal:close
events in the Modal module. Closes #1717 - Added
setRule
andgetRule
in CssComposer module - Added
ignoreCategories
option to therender
method in BlockManager module - Added
customFetch
option in AssetManager module
Fixed
- Avoid updating frame offset on Layer click. Fixes #1711
- Fixed UndoManager in components with
scripts
. Closes #1512 by @thinkanymore
v0.14.50
Docs
Changed
- Improved the extension of components via
DomComponents.addType
Read more about this here - In
isComponent
is not necessary anymore to return the object with itstype
to accept it, any truthy value is enough.
// Before
isComponent: el => {
if (el.tagName === 'SOME-TAG') {
return { type: 'my-component' };
}
}
// After
isComponent: el => el.tagName === 'SOME-TAG'
- Add default attributes in the creation of new components
- Emit
component:clone
event on the component which was cloned - Clear old attributes in
updateAttributes
- Don't trigger component hooks for temporary components
- Improved the parserHtml
Added
- Added
getTypes
method inDomComponents