Skip to content

Commit 5c99d65

Browse files
authored
Merge pull request #3060 from adumesny/master
doc update
2 parents 1b8b503 + 26348e6 commit 5c99d65

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -477,15 +477,18 @@ breaking change:
477477
478478
**Breaking change:**
479479
480+
* V11 add new `GridStack.renderCB` that is called for you to create the widget content (entire GridStackWidget is passed so you can use id or some other field as logic) while GS creates the 2 needed parent divs + classes, unlike `GridStack.addRemoveCB` which doesn't create anything for you. Both can be handy for Angular/React/Vue frameworks.
481+
* `addWidget(w: GridStackWidget)` is now the only supported format, no more string content passing. You will need to create content yourself as shown below, OR use `GridStack.createWidgetDivs()` to create parent divs, do the innerHtml, then call `makeWidget(el)` instead.
480482
* if your code relies on `GridStackWidget.content` with real HTML (like a few demos) it is up to you to do this:
481483
```ts
482484
// NOTE: REAL apps would sanitize-html or DOMPurify before blinding setting innerHTML. see #2736
483485
GridStack.renderCB = function(el: HTMLElement, w: GridStackNode) {
484486
el.innerHTML = w.content;
485487
};
488+
489+
// now you can create widgets like this again
490+
let gridWidget = grid.addWidget({x, y, w, h, content: '<div>My html content</div>'});
486491
```
487-
* V11 add new `GridStack.renderCB` that is called for you to create the widget content (entire GridStackWidget is passed so you can use id or some other field as logic) while GS creates the 2 needed parent divs + classes, unlike `GridStack.addRemoveCB` which doesn't create anything for you. Both can be handy for Angular/React/Vue frameworks.
488-
* `addWidget(w: GridStackWidget)` is now the only supported format, no more string content passing. You will need to create content yourself (`GridStack.createWidgetDivs()` can be used to create parent divs) then call `makeWidget(el)` instead.
489492
490493
**Potential breaking change:**
491494

doc/CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Change log
55
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
66
**Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)*
77

8-
- [12.1.2-dev (2024-05-07)](#1212-2024-05-07)
8+
- [12.1.2-dev (2024-05-07)](#1212-dev-2024-05-07)
99
- [12.1.1 (2024-04-28)](#1211-2024-04-28)
1010
- [12.1.0 (2024-04-23)](#1210-2024-04-23)
1111
- [12.0.0 (2025-04-12)](#1200-2025-04-12)

0 commit comments

Comments
 (0)