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

ng-tinymce-typeahead

v0.0.9

Published

Angular directive tinymce autocomplete menu for links or image quick insertion control.

Downloads

14

Readme

ng-tinymce-typeahead NPM version Build Status Total views

Angular directive tinymce autocomplete menu for links or image quick insertion control.

Why

Insert a link or an image is not user very friendly with tinymce.

Idea is to provide a faster way for inserting images and links in editor.

All you need to do is create your own REST service and consume it with $http or $resource by instance.

Check service example to see current format of results.

Then on your tinymce editor, just press Ctrl+Space or Cmd+Key (mac), and menu will be displayed.

TINY MCE version 4 only.

BOOTSTRAP version 3 only.

Sceenshot

ng-tinymce-typeahead demo ng-tinymce-typeahead demo ng-tinymce-typeahead demo ng-tinymce-typeahead demo ng-tinymce-typeahead demo ng-tinymce-typeahead demo

Demo

http://darul75.github.io/ng-tinymce-typeahead/

How to use it

You should already have script required for Angular.

<-- COMMON LIBS -->
<script type="text/javascript" src="angular.min.js"></script>
<script type="text/javascript" src="bootstrap.js"></script>
<script type="text/javascript" src="tinymce.min.js"></script>
<script type="text/javascript" src="typeahead.js/dist/bloodhound.min.js"></script>
<script type="text/javascript" src="typeahead.js/dist/typeahead.bundle.js"></script>

<-- ANGULAR LIBS PLUGINS -->
<script type="text/javascript" src="angular-ui-tinymce/src/tinymce.js"></script>
<script type="text/javascript" src="angular-typeahead/angular-typeahead.js"></script>

to the list above, you should add:

<link rel="stylesheet" type="text/css" href="dist/ng-tinymce-typeahead.min.css">

<script type="text/javascript" src="dist/ng-tinymce-typeahead.min.js"></script>

Then, inject ui.tinymce and ui.tinymce.typehead in your application module:

angular.module('myApp', ['ui.tinymce', 'ui.tinymce.typehead']);

and then under your tinymce directive add an div with ui-tinymce-linker-menu directive name attribute, menu and menu scope variable attribute (detail below).

Note link or image plugin have to be loaded, if not no issue, menu will just be hidden.

<!-- COMMON usage for TINYMCE-->
<textarea id="tinymce"  
      ui-tinymce='{body_class: "mousetrap", plugins: ["link image"]}' 
      ng-model="tinymce" 
      hotkey="{esc: close, 'ctrl+left': mute}" 
      class="mousetrap"></textarea>
<!-- DIRECTIVE usage for this directive -->
<div ui-tinymce-linker-menu menu="menu" service="service"></div>
myAppModule.controller('MainCtrl', function($scope) {
        
    $scope.menu = [
      { id: '1', label:'Music', icon:'glyphicon-music', children: [
          {id:'1-1', label:'Links', icon: 'glyphicon-link', children: [
            { id: '1-1-1', label:'Rap', type: 'link' },
            { id: '1-1-2', label:'Rock', type: 'link' }
          ]},
          {id:'1-2', label:'Images', icon: 'glyphicon-picture', children: [
            { id: '1-2-1', label:'Rap', type: 'image' },
            { id: '1-2-2', label:'Rock', type: 'image' }
          ]}
      ]},
      { id: '2', label:'Sport', icon:'glyphicon-tower', children: [
         .......
         ....
         ....
      ]}
      
      // THEN YOU NEED TO DEFINE OR USE YOUR OWN SERVICE FOR LINKS RESULT
      // HERE MY PROPOSITION, YOUR SERVICE WILL BE INJECTED AUTOMATICALY
      // SEE MY EXAMPLE : src/tinymce-typeahead-service.js
      $scope.service = {
          module:"ui.tinymce.typeahead.service",      // service module
          name:"typeaheadService",                    // service name
          methodLinks:"FetchLinks",                   // method name to fetch links
          methodImage:"FetchImageLinks"               // method name to fetch image src links
      };
      
    ];
    
});

Required options

  • menu: json menu
  • service: how to inject your service

Todo

  • Improve key detection.
  • Choose better menu model
  • ...many things

Inspiration

https://github.com/Siyfion/angular-typeahead http://twitter.github.io/typeahead.js/ ...

Installation

Using npm:

npm install ng-tinymce-typeahead

Build

You can run the tests by running

npm install

or

npm test

assuming you already have grunt installed, otherwise you also need to do:

npm install -g grunt-cli

License

The MIT License (MIT)

Copyright (c) 2014 Julien Valéry

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.