Releases: GrapesJS/grapesjs
v0.14.40
Changed
- Allow strings in upload function of component image #1462
- Append external styles inside head instead of body #1473
- Improved Style Manager for a better extensibility
- Avoid adding styles for temporary components (eg. created when you drag blocks around the canvas)
Added
- Accepts strings as argument for the assets callback in Style Manager. Closes #1457
- Added
valueTrue
andvalueFalse
options to trait checkbox type. Closes #1424
This feature allows you to customize the boolean attribute on components
Example:
traits: [{
type: 'checkbox',
label: 'Show Name',
name: 'show-name',
valueTrue: 'TRUE-value',
valueFalse: 'FALSE-value',
// For default values you have to specify same true/false values
// You can add `value` in trait or on your components
value: 'FALSE-value',
}]
- Added ComponentStyleClear command and
style-signature
option in Component - Added
setTarget
method in StyleManager - Added
button
trait type - Added
styleManager:update:target
event to track target changes (Component or CSSRule) in Style Manager - Added
getTrait(traitName)
method in Component - Added new methods in Editor:
once
,getWrapper
- Added
log
option to the main config object
Fixed
- Avoid removing component on selector editing
- Store the wrapper if
avoidInlineStyle
is false #TODO issue in project - Return
body
selector, instead of#wrapper
, for the wrapper when requested - Run
npm start
cross-platform. Closes #1456 - Improve hover in SelectComponent command. Fixes #1448
- Avoid errors in case of textnode selection
- Fix duplicated CSS rules with at-rules. Closes #1513
- Update traits when a component is removed. Fixes #1535
v0.14.33
Changed
- Improved the Text component. Fixes #1394
- Improved the Resizer, make it understand
auto
values. #1415 by @nojacko - Re-render buttons on change of any of its properties
- Re-render blocks on change of any of its properties
Added
- Added
remove
method in Component API - Added ComponentWrapper which might be used to help identify the wrapper via
[data-gjs-type=wrapper]
- Added
component:update:components
event, which allows listen to inner components changes. Closes #1409 - Added the possibility to add custom CSS parsers, this will help to avoid inconsistency with built-in browser parsers.
editor.setCustomParserCss(css => {
const result = [];
// ... parse the CSS string
result.push({
atRule: 'media',
params: 'screen and (min-width: 480px)',
selectors: '.someclass:hover, div .otherclass',
style: { color: 'red' }
})
// ...
return result;
});
For an overview on how to built correctly rule objects check the guide here
- Implemented a simple event-based log system, eg:
editor.log('Something done!', { ns: 'from-plugin-x', level: 'info' });
// This will trigger following events
// `log`, `log:info`, `log-from-plugin-x`, `log-from-plugin-x:info`
// Callbacks of those events will always receive the message and
// options, as arguments, eg:
// editor.on('log:info', (msg, opts) => console.info(msg, opts))
Fixed
- Fixed default types in
open-assets
command. Closes #1411 - Don't mess with onbeforeunload unless user wants to. #1417 by @dsgh
- Fixed the class for disabled state of panel buttons. Closes #1421
- Fixed the loading of component, accept also arrays and objects. Closes #1429
- Fixed the initialization of checkbox traits. #1435
- Fix name editing of layers, which was deleting components
v0.14.29
Added
- Added touch support.
In order to make it work properly on all touch devices, you have to use grapesjs-touch plugin, which just includes some essential polyfills (eg. native drag & drop). Big thanks go to @saltyfoam for funding this feature and @Unsigno who actually made the work. There are still few issues regarding some devices (probably not even related to the feature itself), but we hope to fix them soon
v0.14.27
Docs
- Added Canvas module API https://grapesjs.com/docs/api/canvas.html
- Added Component API https://grapesjs.com/docs/api/component.html
Changed
- Replace
isInputFocused
withisEditing
in UndoManager - Clear traits values on init in Components
- Now command's state (active or not) is tracked.
const cm = editor.Commands; cm.run('preview'); cm.isActive('preview'); // -> true cm.stop('preview'); cm.isActive('preview'); // -> false
Added
- Added the possibility to use plugins assigned in
window
. More on this - Added new methods to Commands API:
getAll
,isActive
,getActive
Fixed
v0.14.25
Bug fixes and API improvements
Changed
- Adjust toolbar positioning on component change
Added
- Added
onActive
method in ComponentView which executes onactive
event - Added the possibility to open the modal with title and content via options
eg.editor.Modal.open({ title: 'Title', content: 'Content' })
- Added the possibility to append
label
on component toolbar buttons - Added
run
andstop
methods in Commands module
Fixed
v0.14.23
Changed
- Switched to Webpack v4,
⚠️ runnpm i
if you develop on GrapesJS - Don't output style declaration without value
- Refactored Modal view
Added
- Added
core:component-delete
to the keymap module - Added
togglable
option to Buttons, if it'sfalse
you can't turn off the button once enabled - Added documentation files in
docs
- Added youtube-nocookie.com as video provider #1270
Fixed
v0.14.21
Changed
- Listen for
content
changes inside ComponentView - Enabled
block:drag:*
events when HTML5 Drag&Drop is used
Added
- Added
setOptions
,addOption
andgetOptions
to select property in Style Manager #1215 - Added the possibility to output custom attributes in
toHTML
method - Added the possibility to avoid clearing styles in CSS export
- Added
stopPropagation
in ComponentTextView ondblclick
event - Added
activate
andselect
options to Block models - Added
onAll
method to Component model. Executes a callback on any inner component - Added
resetId
method on Component andresetId
propperty on Block model
This allows to reset id of the component and its binded css rules.
This comes handy when you use ids inside you blocksTechnically speaking, Blocks are reusable and IDs are not, so this will cause a problem.<div id="some-id"></div> <style> #some-id { ... } </style>
So with this new option, IDs will be changed automatically inside all dropped componentsblockManager.add('some-block', { resetId: true, content: `<div>...` })
Fixed
v0.14.20
This release mainly brings 2 new features:
-
This is the first version of this feature and allows the user, at first, organize faster the structure of the template.
The feature is enabled by default but you can disable it by passingmultipleSelection: false
to GrapesJS init function. To start multiple selection just press CTRL (⌘ for Mac users) and click on any additional component. When multiple components are selected you can't style them (at least, not yet) but you can move, copy and delete them. You can also select a range of multiple components of the same collection/list by pressing ⇧ Shift and clicking on start and end component. -
Dynamic Layers Root
With Dynamic Layers Root you can change the default wrapper/body root with any other component inside your template.
On initialization:const editor = grapesjs.init({ container: '#gjs', layerManager: { root: '#my-root', showWrapper: false, }, // ... })
or via API
editor.LayerManager.setRoot('#other-root'); // or via Component editor.LayerManager.setRoot(editor.getSelected());
Changed
- Don't remove classes starting with
{PREFIX}-
Added
- Added
destroy()
method - Added
setRoot
,getRoot
methods in Layers, for Dynamic Layers Root - Added
root
option toconfig.LayerManager
- Added
multipleSelection
option - Added
selectAdd
,selectRemove
,selectToggle
methods in Editor, for Multiple Component Selection feature - Added new commands and their relative keymaps for easy navigation through the structure
core:component-prev
(w)core:component-next
(s)core:component-enter
(d)core:component-exit
(a)
Fixed
- Parse important declarations in style properties #1179
Removed
- Replaced
change:selectedComponent
events withcomponent:toggled
v0.14.17
Changed
- Improved toJSON method of CSSRule
- Try to find a closest model when an element, without it, is selected
Added
- Highlight components in canvas when hovered in Layers #423
- Added
scrollTo
method to the Canvas module - Added
scrollCanvas
,scrollLayers
andhighlightHover
options to Layers module - Add component's type to its view via
data-gjs-type
attribute - Added
jest
for tests