From 26348e6ad0e56f759b4815c2b34358483bcba700 Mon Sep 17 00:00:00 2001 From: Alain Dumesny Date: Tue, 27 May 2025 07:13:09 -0700 Subject: [PATCH] doc update fix #3058 --- README.md | 7 +++++-- doc/CHANGES.md | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 90a58d8e..360721e9 100644 --- a/README.md +++ b/README.md @@ -477,15 +477,18 @@ breaking change: **Breaking change:** +* 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. +* `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. * if your code relies on `GridStackWidget.content` with real HTML (like a few demos) it is up to you to do this: ```ts // NOTE: REAL apps would sanitize-html or DOMPurify before blinding setting innerHTML. see #2736 GridStack.renderCB = function(el: HTMLElement, w: GridStackNode) { el.innerHTML = w.content; }; + +// now you can create widgets like this again +let gridWidget = grid.addWidget({x, y, w, h, content: '
My html content
'}); ``` -* 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. -* `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. **Potential breaking change:** diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 4644fac0..0072066e 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -5,7 +5,7 @@ Change log **Table of Contents** *generated with [DocToc](http://doctoc.herokuapp.com/)* -- [12.1.2-dev (2024-05-07)](#1212-2024-05-07) +- [12.1.2-dev (2024-05-07)](#1212-dev-2024-05-07) - [12.1.1 (2024-04-28)](#1211-2024-04-28) - [12.1.0 (2024-04-23)](#1210-2024-04-23) - [12.0.0 (2025-04-12)](#1200-2025-04-12)