Web Component: j-Paper
j-Paper (BETA)
- jComponent
v19|v20 - output is a simple
Object Arraystructure:[{ id: String, widget: String, newbie: Boolean, changed: Boolean, config: Object }]
- widgets repository: https://github.com/totaljs/parts/tree/main/paper
Configuration:
readonly{Number}enables/disables readonly mode0=disabled,1=partially enabled,2=fully enabledparent{String}optional, a parent element for min-height (default:null)margin{Number}additional margin for min-height (default:0)autosave{Boolean}changes are serialized according to the path automaticallywidgets{String}a link to the widgets (default: Componentator CDN)- it can contain multiple addresses divided by the comma
mywidget1.html,/mywidget2.html,etc.. - or you can keep CDN structure
- it can contain multiple addresses divided by the comma
icon{String}a link to thefunction(opt, callback)opt.element{jQuery element}- IMPORTANT: call the
callbackargument if the icon has been changed in the element
link{String}a link to thefunction(opt)opt.element{jQuery element}opt.href{String}opt.target{String}opt.widget{Object}a widget instance
command{String}a link to thefunction(cmd)cmd.widget{Object}a temporary widget instancecmd.widgets {Array}a list of registered widgetscmd.remove(){Function}removes widgetcmd.append(name)replaces the current temporary widget with a new widget (namename of widget)
format{String}a link to thefunction(toolbar)toolbarcan benulltoolbar.element{jQuery element}a current elementtoolbar.node{HTML element}a current elementtoolbar.widget{Object}a widget instancetoolbar.style{Object}contains a current style e.g.bold: 1, link: 1
upload{String}a link to thefunction(opt, callback)opt.accept{String}optionalopt.files{FileList}optionalopt.multiple{Boolean}optional, default:falseopt.width{Number}optionalopt.height{Number}optional- IMPORTANT:
callbackargument must be executed after upload with thefiles {Array}argument
change{String}a link to thefunction(change)change.id{String}identifierchange.block{String}a block identifierchange.blockprev{String}a previous block identifierchange.widget{String}a widget idchange.type{String}operation type (insert, update, remove)
contextmenu{String}a link to thefunction(widget)when the user pressed the right mouse button on the widgetcheck{String}a link to thefunction(widget)that decides whether to enable editing or notplaceholder{String}a placeholder for the default HTML widget (default:Press / for adding rich content)
Methods:
component.save(function(data, ischange) {for saving contentcomponent.import(url or url_array, [callback])for importing additional widgetscomponent.notify(event, [a], [b], [c], [d])emits event in every widget
Good to know:
The component creates a global variable called window.papercache {Object} used by all j-Paper instances.
- the component compares the content when you change data, so you can change data in real-time
- the component assigns (in the form)
paper-yourwidgetnameclass to every widget element - reserved HTML classes
readonly,widget,selected- readonly usage:
.readonly .paper-yourwidgetname { ... }
- readonly usage:
htmlelement.$widget{Object}contains a widget instancewidget.remove()method will remove the widget
Shortcuts in text edit:
CMD + mhighlights textCMD + lcreates a linkCMD + padds an iconCMD + bboldCMD + iitalicCMD + uunderline
Good to know:
[data-prevent]attribute can prevent click event in the widget
Author
- Peter Širka petersirka@gmail.com
- License
Created
06. october 2022
Updated
11. june 2025
jComponent library
19 | 20
Version
v1
License
https://www.totaljs.com/license/
Dark mode
Yes
Responsive
Yes
Author
Peter Širka
Email
petersirka@gmail.com

