GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - thijsw/angular-medium-editor: AngularJS directive for Medium.com editor clone

This repository was archived by the owner on Nov 10, 2026. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

57 Commits
57 Commits

Folders and files

NameName
Last commit message
Last commit date
demo
demo
 
 
dist
dist
 
 
src
src
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.jshintrc
.jshintrc
 
 
.travis.yml
.travis.yml
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Gruntfile.js
Gruntfile.js
 
 
README.md
README.md
 
 
bower.json
bower.json
 
 
package.json
package.json
 
 

Repository files navigation

angular-medium-editor

Warning

This project is no longer maintained and the repository is archived.

  • AngularJS reached end of life in December 2021 and no longer receives security fixes.
  • medium-editor, the editor this directive wraps, has not had a release since 2017.
  • The 4.0.0-alpha release (Angular 4) was never packaged correctly and does not work. It is deprecated on npm.

Version 1.2.1 keeps working for existing AngularJS apps, but no new fixes will be released. For new projects, use an actively maintained rich-text editor, for example one built on Tiptap, Quill or ngx-editor.

The code is MIT licensed, so you are welcome to fork it. Thanks to everyone who contributed over the years!

This is an AngularJS directive for the Medium.com inline editor clone by Davi Ferreira.

Install

Install with Bower:

$ bower install --save angular-medium-editor

Install with Npm:

$ npm install --save angular-medium-editor

Then add <script> to your index.html:

<script src="/bower_components/angular-medium-editor/dist/angular-medium-editor.js"></script>

Remember to include Angular and Medium editor before the directive.

Then add angular-medium-editor as a dependency for your app:

angular.module('myApp', ['angular-medium-editor']);

Documentation

Use as an element:

<medium-editor></medium-editor>

...or attribute:

<p medium-editor></p>

Pass options with bind-options attribute:

<p medium-editor bind-options="options"></p>

See MediumEditor's options documentation for details.

Examples

Single line, no toolbar

Header example limited to one line and no toolbar

<h1 ng-model="title" medium-editor bind-options="{disableReturn: true, disableExtraSpaces: true, toolbar: false}" data-placeholder="Enter a title"></h1>

Multiline with custom toolbar

Paragraph with support for multiple lines and customized toolbar buttons

<p ng-model="description" medium-editor bind-options="{'toolbar': {'buttons': ['bold', 'italic', 'underline']}}" data-placeholder="Enter a description"></p>

Custom extension

Example for extending the toolbar with customized element highlighter (using rangy and the CSS Class Applier Module to support highlighting of text). For more detailed info on extensions, please refer to MediumEditor.

<p ng-model="text" medium-editor bind-options="mediumBindOptions"></p>
function Highlighter() {
  this.button = document.createElement('button');
  this.button.className = 'medium-editor-action';
  this.button.innerText = 'H';
  this.button.onclick = this.onClick.bind(this);
  this.classApplier = rangy.createCssClassApplier('highlight', {
    elementTagName: 'mark',
    normalize: true
  });
}
Highlighter.prototype.onClick = function() {
  this.classApplier.toggleSelection();
};
Highlighter.prototype.getButton = function() {
  return this.button;
};
Highlighter.prototype.checkState = function(node) {
  if (node.tagName == 'MARK') {
    this.button.classList.add('medium-editor-button-active');
  }
};

scope.mediumBindOptions = {
  toolbar: {
    buttons: ['bold', 'italic', 'highlight']
  },
  extensions: {
    highlight: new Highlighter()
  }
};

Running the demo

If you want to view the included demo, you have to run bower first in order to retrieve the dependencies.

License

The MIT License

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.

About

AngularJS directive for Medium.com editor clone

Topics

angularjavascriptmedium-editor

Resources

Readme

Contributing

Contributing
Activity

Stars

304 stars

Watchers

14 watching

Forks

94 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.