Redaxtor
Redaxtor is a JavaScript library for editing CMS pieces, pages and internationalisation on the client side. Based on React and Redux. Built with Webpack. Written in ES2015. Created by SpiralScout.
Installation
Install redaxtor base and it's plugins
npm install --save redaxtor
npm install --save redaxtor-medium
npm install --save redaxtor-codemirror
npm install --save redaxtor-seo
The Gist (CommonJS)
See Typescript Typings for more details
// Include redaxtor and it's default styles var Redaxtor = ; ; // Include redaxtor Rich Text editor and it's default styles // RedaxtorMedium exports 3 components: // var RedaxtorMedium = ; ; ; // Include redaxtor source code editor and it's default styles var RedaxtorCodemirror = ; ; // Attach plugins to redaxtor var components = html: RedaxtorMediumHTMLEditor image: RedaxtorMediumIMGTagEditor background: RedaxtorMediumBackgroundImageEditor source: RedaxtorCodemirror ; var redaxtor = pieces: components: components options: html: pickerColors: "#666" "#212121" "#f39c12" "#d2d064" "#4fbbf7" "#ffffff" piecesRoot: document //Optional. Set document by default. Set root element for pieces editorActive: true //Optional. Default: false, If set enables everything editors for pieces after loading navBarRoot: document //Optional. Default: document.body, Set place for the Redaxtor bar navBarDraggable: true //Optional. Default: true, If set `true` enables dragging of the redaxtor panel navBarCollapsable: true //Optional. Default: true, If set `true` enables collapsing of the redaxtor panel. If set `false` set the panel to the open state and disables collapsing navBarCollapsed: true //Optional. Default: true, defines navbar is collapsed on creating or not pieceNameGroupSeparator: ':' // Optional. Set name separator for grouping blocks api: /** * Method to fetch list of image urls for gallery * Should resolve into array of strings - URLS */ { return { $; }; } { } /** * function for delete image from server * @param id id of image * @returns */ { return { ; }; } /** * Method to specific piece data * Should resolve into piece object, having all needed properties */ { if piecetype == "source" || piecetype == "html" /** * Source and html editors expect `html` property * updateNode - define that is need to update piece after change code. Default value: true */ return Promise; if piecetype == "image" /** * Image editor expects `src` property with URL of image and `alt` string */ return Promise; if piecetype == "background" /** * Background editor expects a set of background styling properties */ return Promise; return Promise } /** * Should resolve, if piece was saved */ { console; return Promise; } ;
The Gist (Static)
<!-- Include redaxtor and it's default styles --> <!-- Include redaxtor HTML editor and it's default styles --> <!-- Include redaxtor CODE editor and it's default styles -->
//Attach plugins to redaxtorvar components = html: RedaxtorMediumHTMLEditor image: RedaxtorMediumIMGTagEditor background: RedaxtorMediumBackgroundImageEditor source: RedaxtorCodemirror; var redaxtor = pieces: components: components options: html: //Pass options to HTML Editor pickerColors: "#666" "#212121" "#f39c12" "#d2d064" "#4fbbf7" "#ffffff" piecesRoot: document //Optional. Set document by default. Set root element for pieces enableEdit: true //Optional. Default: false, If set enables everything editors for pieces after loading navBarRoot: document //Optional. Default: document.body, Set place for the Redaxtor bar navBarDraggable: true //Optional. Default: true, If set `true` enables dragging of the redaxtor panel navBarCollapsable: true //Optional. Default: true, If set `true` enables collapsing of the redaxtor panel. If set `false` set the panel to the open state and disables collapsing api: /** * Method to fetch list of image urls for gallery * Should resolve into array of strings - URLS */ { return { $; }; } { } /** * function for delete image from server * @param id id of image * @returns */ { return { ; }; } /** * Method to specific piece data * Should resolve into piece object, having all needed properties */ { if piecetype == "source" || piecetype == "html" /** * Source and html editors expect `html` property * updateNode - define that is need to update piece after change code. Default value: true */ return Promise; if piecetype == "image" /** * Image editor expects `src` property with URL of image and `alt` string */ return Promise; if piecetype == "background" /** * Background editor expects a set of background styling properties */ return Promise; return Promise } /** * Should resolve, if piece was saved */ { console; return Promise; } ;
Developing and building
npm installnpm run build
License
MIT