@liferay-editor-custom-fields/framework 7.4.3 → 7.4.5
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 +31 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,28 +1,50 @@
|
|
|
1
1
|
# Liferay Custom Fields Framework
|
|
2
2
|
|
|
3
|
-
The engine behind Liferay
|
|
3
|
+
The engine behind Liferay Editor Custom Fields.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Before You Start
|
|
6
|
+
|
|
7
|
+
Any client extension using this framework should not run on a production or pre-prod staging environment. It is only intended for the fragment and web content editors. Any JS that will end up on the page should be elsewhere, either in a separate client extension or in the fragment/web content template.
|
|
8
|
+
|
|
9
|
+
You only need this if you are creating a new Liferay Editor Custom Fields package, otherwise it is provided as a dependency on existing ones.
|
|
6
10
|
|
|
7
11
|
## Getting Started
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
- Install @liferay-editor-custom-fields/framework
|
|
14
|
+
- Make sure the version matches the minor version of Liferay you are using
|
|
15
|
+
- For example `yarn add @liferay-editor-custom-fields/framework@~7.4.0` for Liferay 7.4.
|
|
16
|
+
- In the index.ts of your app:
|
|
17
|
+
- Declare the Liferay global object
|
|
18
|
+
- Import the default exported function from @liferay-editor-custom-fields/framework. You can call it something short like initFramework();
|
|
19
|
+
- Create a default exported function of your own and call that function
|
|
20
|
+
- Write a Liferay.on event subscriber for each event that your app will be using. See the Events section of this document for a list of events.
|
|
10
21
|
|
|
22
|
+
```
|
|
23
|
+
declare const Liferay;
|
|
11
24
|
|
|
12
|
-
|
|
25
|
+
import initFramework from '@liferay-editor-custom-fields/framework';
|
|
13
26
|
|
|
14
|
-
|
|
27
|
+
const initImageTools: () => void = () => {
|
|
28
|
+
initFramework();
|
|
29
|
+
Liferay.on('EditorCustomFields_WebContentFields_OnLoad', ()=>{});
|
|
30
|
+
Liferay.on('EditorCustomFields_FragmenConfig_OnLoad', ()=>{});
|
|
31
|
+
Liferay.on('EditorCustomFields_Image_OnChange', ()=>{});
|
|
32
|
+
}
|
|
33
|
+
export default initImageTools;
|
|
34
|
+
```
|
|
15
35
|
|
|
16
|
-
|
|
36
|
+
## Events
|
|
17
37
|
|
|
18
38
|
Use Liferay.on to subscribe to these events:
|
|
39
|
+
|
|
19
40
|
- `EditorCustomFields_WebContentFields_OnLoad` - Fires when web content field DOM is loaded.
|
|
20
41
|
- `EditorCustomFields_FragmenConfig_OnLoad` - Fires when a new Fragment config is loaded on the right pane of a page editor.
|
|
21
42
|
- `EditorCustomFields_Image_OnChange` - Fires when an lfr-editable image or Web Content image is changed.
|
|
22
43
|
|
|
23
|
-
|
|
44
|
+
## Helper functions
|
|
45
|
+
|
|
46
|
+
The helper functions below are available for import in any file. For example, to use the getFieldByLabel helper you would use `import { getFieldByLabel } from "@liferay-editor-custom-fields/framework";`
|
|
24
47
|
|
|
25
|
-
The helper functions below are children of Liferay.editorCustomFields
|
|
26
48
|
- `debounce(callback:function, wait:number)` - A simple callback function
|
|
27
49
|
- `getContentImageInput(label:string)` - Gets the metadata input field associated with the web content image.
|
|
28
50
|
- `getFieldByLabel(label:string)` - Uses Xpath to get an input field by its label. Usually used to append a GUI element.
|
|
@@ -31,4 +53,4 @@ The helper functions below are children of Liferay.editorCustomFields
|
|
|
31
53
|
|
|
32
54
|
## License
|
|
33
55
|
|
|
34
|
-
MIT Licensed. Copyright (c) Xtivia 2026.
|
|
56
|
+
MIT Licensed. Copyright (c) Xtivia 2026.
|
package/package.json
CHANGED