Javascript canvas editor based on konva.js (https://konvajs.org/)
npm install ajjya-ajte-canvas-aditorshell
$ npm install ajjya-ajte-canvas-aditor
`
Install via yarn:
`shell
$ yarn add ajjya-ajte-canvas-aditor
`
Include code and style:
`js
import 'ajjya-ajte-canvas-aditor/ajteditor.scss';
import JTEEditor from 'ajjya-ajte-canvas-aditor';
const AJTEAdminEditor = AJTEEditor.AJTEAdminEditor;
const AJTEUserEditor = AJTEEditor.AJTEUserEditor;
`
---
> Please take into consideration to use the modern version and add polyfills later to your final bundle!
> (Or better: give a hint to users that they should use the latest browsers).
> Browsers such as IE are not supported (at least not officially).
$3
`html
`
Usage
There are 2 variants for usage:
#### AJTEAdminEditor - this is full editor where you can create template.
#### AJTEUserEditor - this is user editor where you can user created template and just allow user change content from created template.
`javascript
import FontFaceObserver from 'fontfaceobserver';
document.addEventListener('DOMContentLoaded', function () {
var fontA = new FontFaceObserver('Akaya Telivigala');
var ajteEditor = new AJTEAdminEditor({
containerOffset: {
x: 0,
y: 70
},
saveInfo: {
requestHeaders: [
{'X-CSRF-TOKEN': csrf}
],
url: "path/to/controllers/which/save/templates",
},
scriptUrl: "path/to/module",
code: code,
title: title,
category: category,
templateId: templateId,
cb:{
image_cb: function(){
console.log('image is loaded then user used Image element')
},
after_create_cb: function(templateId){
console.log('editor elements are loaded')
},
success_cb: function(message){
console.log('success callback')
},
error_cb: function(message){
console.log('error callback')
},
init_cb: function(){
console.log('editor inited elements')
afterInit()
}
}
});
function afterInit(){
fontA.load().then(function () {
ajteEditor.addFont('Akaya Telivigala');
});
}
});
`
`html
``