grapesjs-forms 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/editor/FormComponents.d.ts +9 -0
- package/dist/grapesjs-forms.js +619 -594
- package/dist/grapesjs-forms.js.map +1 -1
- package/dist/grapesjs-forms.umd.cjs +5 -5
- package/dist/grapesjs-forms.umd.cjs.map +1 -1
- package/dist/grapesjs-forms.umd.js +5 -5
- package/dist/plugin.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,6 +48,9 @@ Or with `<script>`: `grapesjs-forms.umd.js` registers itself as `grapesjs-forms`
|
|
|
48
48
|
2. **Blocks → Forms**: one block per form, and *New form* (creates one and opens the editor).
|
|
49
49
|
A form component has a *Form* trait (switch the form) and *Edit the form*; double-click opens the editor too.
|
|
50
50
|
3. Inside, the parts are made by the plugin: they can be selected and **styled**, not moved or deleted.
|
|
51
|
+
Every part is its own layer (field → label, input, help, error; options; the button), and each has
|
|
52
|
+
a stable id made from the form component, the field and the part (`gjsf-k3x9a-email-label`), so
|
|
53
|
+
styles given to one part in GrapesJS (`#…` rules) stay with it when the form is edited or rebuilt.
|
|
51
54
|
When the form changes, every component of it in the open project is rebuilt (not on the undo stack);
|
|
52
55
|
the classes and attributes you added to the `<form>` stay. A project opened later with an older copy
|
|
53
56
|
is brought up to date. A deleted form leaves its copy, marked.
|
|
@@ -5,6 +5,14 @@ export declare const FORM_TYPE = "gjsf-form";
|
|
|
5
5
|
export declare const PART_TYPE = "gjsf-part";
|
|
6
6
|
export declare const FORM_ATTR = "data-gjsf-form";
|
|
7
7
|
export declare const PART_ATTR = "data-gjsf-part";
|
|
8
|
+
/**
|
|
9
|
+
* Gives every built element without an id a stable one, made from the
|
|
10
|
+
* component's key, the field it belongs to and its part
|
|
11
|
+
* (`gjsf-k3x9a-email-label`, `gjsf-k3x9a-form-submit`): a rebuild (the form
|
|
12
|
+
* was edited, another page opened) makes the same ids, so styles given to
|
|
13
|
+
* the parts in GrapesJS (`#…` rules) stay with them.
|
|
14
|
+
*/
|
|
15
|
+
export declare function stableIds(els: Array<El | string>, key: string): Array<El | string>;
|
|
8
16
|
/** A built element as a GrapesJS component definition. */
|
|
9
17
|
export declare function toComponent(el: El | string): Record<string, unknown>;
|
|
10
18
|
export interface FormHost {
|
|
@@ -56,6 +64,7 @@ export declare class FormComponents {
|
|
|
56
64
|
* whose form is gone keeps its parts (a copy) and is marked.
|
|
57
65
|
*/
|
|
58
66
|
rebuild(c: Component): void;
|
|
67
|
+
private find;
|
|
59
68
|
/** Rebuilds the components of one form (all when no id); `stale` — only those built from another version or for another page. */
|
|
60
69
|
rebuildAll(formId?: string | null, stale?: (c: Component, f: FormDef) => boolean): number;
|
|
61
70
|
destroy(): void;
|