npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aurelia-tinymce-wrapper

v1.2.3

Published

Aurelia plugin wrapper for TinyMCE. A WYSIWYG HTML Rich Text Editor.

Downloads

5

Readme

aurelia TinyMCE

Aurelia TinyMCE HTML Rich Text Editor Plugin

Installation

  1. npm install aurelia-tinymce-wrapper --save
  2. (aurelia-cli) add package to the dependencies in the aurelia.json file.
{
  "name": "aurelia-tinymce-wrapper",
  "path": "../node_modules/aurelia-tinymce-wrapper/dist/amd",
  "main": "index",
  "resources": [
    "**/*.html"
  ]
},
{
  "name": "tinymce",
  "path": "../node_modules/tinymce",
  "main": "tinymce"
},
"timers"
  1. copy the directory node_modules/tinymce/skins to the scripts folder.
  2. If you get the error plugin.load is not a function go back to aurelia.json and set build loader plugins stub to false
"loader": {
  "type": "require",
  "configTarget": "vendor-bundle.js",
  "includeBundleMetadataInConfig": "auto",
  "plugins": [
    {
      "name": "text",
      "extensions": [
        ".html",
        ".css"
      ],
      "stub": false
    }
  ]
},

Usage

  1. add the plugin to your main.js file.
import environment from './environment';

export function configure(aurelia) {
  aurelia.use
    .standardConfiguration()
    .plugin('aurelia-tinymce-wrapper') //<-- This line
    .feature('resources');

  if (environment.debug) {
    aurelia.use.developmentLogging();
  }

  if (environment.testing) {
    aurelia.use.plugin('aurelia-testing');
  }

  aurelia.start().then(() => aurelia.setRoot());
}
  1. add the element to the view where you want the editor to go.
  • app.html :
<template>
  <h1>My Html Editor</h1>
  <tiny-mce theme="modern" content.bind="content"></tiny-mce> <!--This line-->
</template>
  • app.js :
import 'tinymce/themes/modern/theme'; //Don't forget to import the theme you want to use
export class App {
  constructor() {
    this.content = 'Hello World!';
  }
}
  1. the same, inline version
  • app.html :
<template>
  <h1>My Html Editor</h1>
  <tiny-mce inline theme="modern" content="hello world"></tiny-mce> <!--This line-->
</template>
  • app.js :
import 'tinymce/themes/modern/theme'; //Don't forget to import the theme you want to use
export class App {
  constructor() {
    this.content = 'Hello World!';
  }
}

Bindable attribute

content {string}

You can bind the content attribute, even with a two-way binding, like this :

<template>  
  <tiny-mce content.two-way="content"></tiny-mce>
  <div>${content}</div>
</template>

options {object}

One of the most important attributes. It gives you access to Tincymce configuration options. You can find these options in the documentation on Tinymce's website. Here is an example:

  • app.js :
import 'tinymce/plugins/link/plugin';
import 'tinymce/plugins/paste/plugin';
import 'tinymce/plugins/hr/plugin';
import 'tinymce/plugins/image/plugin';
import 'tinymce/plugins/media/plugin';
import 'tinymce/plugins/code/plugin';
import 'tinymce/plugins/lists/plugin';
import 'tinymce/themes/modern/theme';

export class App {
  constructor() {
    this.options = {
      toolbar:"formatselect bold italic | bullist numlist | link unlink | image media | code",
      menubar:false,
      plugins: ['link', 'paste', 'code','media','image','lists'],
      branding: false,      
      hidden_input:true,
      browser_spellcheck: true
    };
  }
}
  • app.html :
<template>  
  <tiny-mce content.two-way="content" options.bind="options"></tiny-mce>
  <div>${content}</div>
</template>

theme {string} - "modern"|"inlite"|"mobile"

Allows you to choose between the 3 available themes:"modern","inlite" and "mobile". "modern" is selected by default. If you choose the theme "inlite", you must also activate the attribute "inline". Conversely, the "mobile" theme cannot work with the "inline"attribute. To be able to use a theme, you must import it into your view-model.

  • app.js :
import 'tinymce/themes/mobile/theme'; //Don't forget to import the theme you want to use
export class App {
  constructor() {
    this.content = 'Hello World!';
  }
}
  • app.html :
<template>
  <h1>My Html Editor</h1>
  <tiny-mce theme="mobile" content="hello world"></tiny-mce> <!--This line-->
</template>

inline

If present, activate inline mode. The inline mode only works with the themes "modern" and "inlite".

<template>  
  <tiny-mce content.two-way="content" inline></tiny-mce>
  <div>${content}</div>
</template>

Localization

First you need to go to Tinymce's website to retrieve the language package file and the corresponding code : https://www.tinymce.com/download/language-packages/

Then you must import this file and activate the language selected in the configuration. Here is an example with french :

  • app.js :
import 'tinymce/themes/modern/theme';
import './fr_FR';
export class App {
  constructor() {
    this.options = {
      language :'fr_FR'
    };
  }
}
  • app.html :
<template>  
  <tiny-mce content.two-way="content" options.bind="options"></tiny-mce>
  <div>${content}</div>
</template>