Skip to content
This repository has been archived by the owner on Jun 18, 2022. It is now read-only.

arabsight/aurelia-trumbowyg-plugin

Repository files navigation

aurelia-trumbowyg-plugin

Install

npm i jquery trumbowyg aurelia-trumbowyg-plugin

Bundle (CLI requirejs)

"jquery",
{
    "name": "trumbowyg",
    "path": "../node_modules/trumbowyg/dist",
    "main": "trumbowyg",
    "deps": ["jquery"],
    "resources": [
        "ui/trumbowyg.css"
    ]
},
{
    "name": "aurelia-trumbowyg-plugin",
    "path": "../node_modules/aurelia-trumbowyg-plugin/dist/amd",
    "main": "index"
}

Register

aurelia.use.plugin('aurelia-trumbowyg-plugin');

WebPack

import svgPath from 'trumbowyg/dist/ui/icons.svg';

...
aurelia.use.plugin(PLATFORM.moduleName('aurelia-trumbowyg-plugin'), {svgPath});
...

Usage

<require from="trumbowyg/ui/trumbowyg.css"></require>

<trumbowyg-editor value.bind="message"></trumbowyg-editor>

Options

For global options pass a trumbowyg config object when registering the plugin:

let options = {
  /* trumbowyg options */
};

aurelia.use.plugin('aurelia-trumbowyg-plugin', options);

If you want per-instance options use the bindable options property:

<trumbowyg-editor value.bind="content"
        options.bind="{ /* trumbowyg options */ }">
</trumbowyg-editor>