Gathering detailed insights and metrics for @jaspero/fb-tinymce
Gathering detailed insights and metrics for @jaspero/fb-tinymce
npm install @jaspero/fb-tinymce
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last day
-45.8%
13
Compared to previous day
Last week
-7.4%
63
Compared to previous week
Last month
347.1%
380
Compared to previous month
Last year
-58.1%
4,488
Compared to previous year
1
2
Library | Version |
---|---|
Core | |
Fields Material | |
Segments Materila | |
Page Builder | |
Form UI | |
Tinymce | |
Monaco Editor |
To install this library, run:
1$ npm install --save @jaspero/form-builder
If you need to render the forms in the UI you'll need to add fields and segments. Fields and segments are installed separably from the core module. We provide one set of fields and segments built with material.
1$ npm install --save @jaspero/fb-fields-mat 2$ npm install --save @jaspero/fb-segments-mat
Add them in to your module like this:
1@NgModule({ 2 imports: [ 3 FbFieldsMatModule.forRoot({prefix: ''}), 4 FbSegmentsMatModule.forRoot({prefix: ''}), 5 ] 6})
Giving them an empty prefix
defines them as the defaults.
FileComponent
, ImageComponent
or GalleryComponent
are used.In order to make the generated forms customizable, this library doesn't provide any default styles. This means that the styles need to be loaded in the root of your application. A good starting point are the example styles provided here.
This configuration is used for defining addition field based options. Changing the label or
what component is used to represent the field in the form. The Definitions
interface looks like this:
Property | Type | Description | Default |
---|---|---|---|
label | string | Label of the field | uses the name of the property |
hint | string | Shows a hint below the field if defined | - |
defaultValue | any | What the value of the field should be if empty | - |
component | object | {type: string, configuration: any} - The type defines the field to use and the configuration is used for any additional component specific options | What ever is the default for the property type |
Name | Selector | Description | Configuration Options |
---|---|---|---|
Input | input | A simple input | {type: 'text', 'number', 'email'} |
1{ 2 "name": { 3 "label": "Name", 4 "defaultValue": "John" 5 }, 6 "age": { 7 "label": "Age", 8 "component": { 9 "type": "slider" 10 } 11 } 12}
FieldComponent
. You should inject COMPONENT_DATA
in order to receive FieldData
, most importantly the underlining FormControl
.CUSTOM_FIELDS
provider e.g.
1providers: [{ 2 provide: CUSTOM_FIELDS, 3 useValue: { 4 'new-component': NewComponent 5 } 6}]
definitions
.CustomComponent
. It receives the CUSTOM_COMPONENT_DATA
which has the form
and id
properties.CUSTOM_COMPONENTS
provider e.g.
1providers: [{ 2 provide: CUSTOM_COMPONENTS, 3 useValue: { 4 example: ExampleComponent 5 } 6}]
1"segments": [{ 2 "components": [{"selector": "example"}] 3}]
The form builder supports both arrays of primitives and object arrays.
The following is required to render an object array:
1{ 2 "addresses": { 3 "type": "array", 4 "items": { 5 "type": "object", 6 "properties": { 7 "city": { 8 "type": "string" 9 }, 10 "address": { 11 "type": "string" 12 } 13 } 14 } 15 } 16}
1{ 2 "segments": [{ 3 "array": "/addresses", 4 "fields": [ 5 "/city", 6 "/address" 7 ] 8 }] 9}
1{ 2 "definitions": { 3 "addresses/city": { 4 "label": "City" 5 } 6 } 7}
Primitive arrays can be displayed in two variations as a dedicated segment or as a field.
If the property is defined with out an items
value. It's expected to be used as a field.
In that case the following components can be used:
{multiple: true}
If an items value is defined then it's expected to be rendered as its own segments.
This plugin registers a field tinymce
for rendering the TinyMCE WYSIWYG Editor.
Library | Version |
---|---|
Tinymce | 5.x |
npm i --save @jaspero/fb-tinymce
TinymceModule
to your modulenpm i --save tinymce
assets
array in angular.json
1{ 2 "glob": "**/*", 3 "input": "node_modules/tinymce/themes/silver", 4 "output": "/themes/silver" 5}, 6{ 7 "glob": "**/*", 8 "input": "node_modules/tinymce/skins/ui/oxide", 9 "output": "/skins/ui/oxide" 10}, 11{ 12 "glob": "**/*", 13 "input": "node_modules/tinymce/skins/content/default", 14 "output": "/skins/content/default" 15}, 16{ 17 "glob": "**/*", 18 "input": "node_modules/tinymce/plugins", 19 "output": "/plugins" 20}, 21{ 22 "glob": "**/*", 23 "input": "node_modules/tinymce/icons", 24 "output": "/icons" 25}
scripts
array in angular.json
"./node_modules/tinymce/tinymce.min.js"
1 "allowedCommonJsDependencies": [ 2 "json-pointer", 3 "tinymce/plugins/wordcount", 4 "tinymce/plugins/table", 5 "tinymce/plugins/lists", 6 "tinymce/plugins/print", 7 "tinymce/plugins/link", 8 "tinymce/plugins/image", 9 "tinymce/plugins/imagetools", 10 "tinymce/plugins/fullscreen", 11 "tinymce/plugins/code", 12 "tinymce/plugins/autolink", 13 "tinymce/plugins/advlist" 14 ]
This plugin registers a field ref-table
that enables the editing of referenced item in an array and adding new references.
This plugin doesn't have any additional dependencies.
npm i --save @jaspero/fb-ref-table
FbRefTableModule
to your moduleNote: If doing something like users/{{id}}/notifications
it's important to have an initial value for the id.
This plugin registers a field pb-blocks
for rendering a page builder module.
This plugin doesn't have any additional dependencies.
Using InlineEditorModule
allows for editing blocks inline (not just in the sidebar on the left). There are 3 directives you can utilize.
ImageIEDirective(fbPbImageIE)
- This directive is for editing image urls. It adds an edit icon and optionally other custom components.
It strictly needs to be used on a block element that is the direct parent to an image element that has no siblings.SingleLineIEDirective(fbPbSingleLineIE)
- This directive is for editing a single element. It adds a toolbar that allows for element type changes,
alignment and decoration. The directive needs to be placed on the parent element, and the target element should have no siblings.MultiLineIEDirective(fbPbMultiLineIE)
- This directive provides the same functionality as the single line directive but allows for multiline editing.This plugin registers a field fu-fields
for rendering a form builder module.
This plugin doesn't have any additional dependencies.
Install the plugin npm i --save @jaspero/fb-form-ui
Add the plugin module TinymceModule
to your module
Add translation files for your specific language. This is en:
1{ 2 "FU": { 3 "ID": "ID", 4 "LABEL": "Label", 5 "VALUE": "Value", 6 "HINT": "Hint", 7 "ORGANIZE": "Organize", 8 "PLACEHOLDER": "Placeholder", 9 "ADJUST_SIZE": "Adjust Size", 10 "ADD_FIELD": "Add Field", 11 "REQUIRED": "Required", 12 "CHANGE_TYPE": "Change Type", 13 "EDIT": "Edit", 14 "REMOVE": "Remove", 15 "OPTIONS": "Options", 16 "SETTINGS": "Settings", 17 "DEFAULT_PLACEHOLDER": "There are no fields currently.", 18 "SIZE": { 19 "DESKTOP": "Desktop", 20 "TABLET": "Tablet", 21 "MOBILE": "Mobile" 22 }, 23 "TYPE": { 24 "checkbox": "Checkbox", 25 "email": "Email", 26 "number": "Number", 27 "select": "Select", 28 "text": "Text", 29 "textarea": "Textarea" 30 } 31 } 32}
You can now use the field in your schemas like this:
schema.properties
1{"fields": {"type": "array"}}
layout.segments
1{ 2 "fields": { 3 "component": { 4 "type": "fu-fields" 5 } 6 } 7}
layout.instance.segments
1{ 2 "type": "empty", 3 "fields": ["/fields"] 4}
Conditional Segments
1{ 2 "fields": [ 3 "/showTitle", 4 { 5 "field": "/title", // Field to assign actions 6 "deps": ["/showTitle"], // Array of fields on which to listen for a change, if none are provided whole form is used as a listener 7 "action": // Single action object or an array of objects 8 [ 9 { 10 "type": "show", // "show" | "hide" | "set-to" 11 "eval": "(row) => row.showTitle" 12 }, 13 { 14 "type": "set-to", 15 "eval": "(row) => !row.title", 16 "configuration": { 17 "value": "Placeholder Title" 18 } 19 } 20 ] 21 } 22 ] 23}
npm i --save @jaspero/fb-page-builder
PageBuilderModule
to your moduleThis plugin registers a field monaco
for rendering the Microsoft Monaco Editor.
Library | Version |
---|---|
@monaco-editor/loader | 1.0.0 |
monaco-editor | ^0.23.0 |
npm i --save @jaspero/fb-monaco-editor monaco-editor @monaco-editor/loader
MonacoEditorModule
to your moduleassets
array in angular.json
1{ 2 "glob": "**/*", 3 "input": "node_modules/ngx-monaco-editor/assets/monaco", 4 "output": "./assets/monaco/" 5}
npm ci
npm start
ng g library [plugin-name] --prefix="fb-[library-prefix]"
@jaspero/
prefix in the projects package.json
release
property as well. Example from tincymce
plugin.
1 "release": { 2 "pkgRoot": "../../dist/@jaspero/fb-tinymce", 3 "branch": "master", 4 "verifyConditions": [ 5 "@semantic-release/changelog", 6 "@semantic-release/npm", 7 "@semantic-release/git" 8 ], 9 "prepare": [ 10 "@semantic-release/changelog", 11 "@semantic-release/npm", 12 "@semantic-release/git" 13 ], 14 "publish": [ 15 "@semantic-release/npm", 16 [ 17 "@semantic-release/github", 18 { 19 "assets": [ 20 "dist/@jaspero/fb-tinymce" 21 ] 22 } 23 ] 24 ], 25 "plugins": [ 26 "@semantic-release/commit-analyzer", 27 "@semantic-release/release-notes-generator" 28 ] 29 }
ng-package.prod.json
example from tinymce
1{ 2 "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", 3 "dest": "../../dist/@jaspero/fb-tinymce", 4 "lib": { 5 "entryFile": "src/public-api.ts" 6 } 7}
angular.json
extend the architect.configurations.production
with ng-package.prod.json
1 "configurations": { 2 "production": { 3 "tsConfig": "projects/page-builder/tsconfig.lib.prod.json", 4 "project": "projects/page-builder/ng-package.prod.json" 5 } 6}
1export class TinymceModule { 2 constructor( 3 private ctx: FormBuilderContextService 4 ) { 5 this.ctx.registerField( 6 'tinymce', 7 TinymceComponent 8 ); 9 } 10}
package.json
. Make sure to include the build command in the build:library
script.npm publish --access public
in dist/@jaspero/[package-name]
.MIT © Jaspero Ltd
No vulnerabilities found.
No security vulnerabilities found.