{"id":16241288,"url":"https://github.com/thijsw/angular-medium-editor","last_synced_at":"2025-04-04T17:08:09.512Z","repository":{"id":11747913,"uuid":"14277715","full_name":"thijsw/angular-medium-editor","owner":"thijsw","description":"AngularJS directive for Medium.com editor clone","archived":false,"fork":false,"pushed_at":"2018-03-04T18:11:49.000Z","size":225,"stargazers_count":303,"open_issues_count":23,"forks_count":94,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-10-10T23:14:03.859Z","etag":null,"topics":["angular","javascript","medium-editor"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thijsw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-10T14:28:38.000Z","updated_at":"2023-12-06T07:05:44.000Z","dependencies_parsed_at":"2022-08-30T14:51:23.578Z","dependency_job_id":null,"html_url":"https://github.com/thijsw/angular-medium-editor","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thijsw%2Fangular-medium-editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thijsw%2Fangular-medium-editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thijsw%2Fangular-medium-editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thijsw%2Fangular-medium-editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thijsw","download_url":"https://codeload.github.com/thijsw/angular-medium-editor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217184,"owners_count":20903009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","javascript","medium-editor"],"created_at":"2024-10-10T14:06:57.217Z","updated_at":"2025-04-04T17:08:09.487Z","avatar_url":"https://github.com/thijsw.png","language":"JavaScript","readme":"# angular-medium-editor\nThis is an AngularJS directive for the [Medium.com inline editor clone](https://github.com/yabwe/medium-editor) by Davi Ferreira.\n\n## Install\n\nInstall with [Bower](https://bower.io/):\n```sh\n$ bower install --save angular-medium-editor\n```\n\nInstall with [Npm](https://www.npmjs.com/):\n```sh\n$ npm install --save angular-medium-editor\n```\n\nThen add `\u003cscript\u003e` to your `index.html`:\n\n```html\n\u003cscript src=\"/bower_components/angular-medium-editor/dist/angular-medium-editor.js\"\u003e\u003c/script\u003e\n```\n\nRemember to include Angular and [Medium editor](https://github.com/yabwe/medium-editor) before the directive.\n\nThen add `angular-medium-editor` as a dependency for your app:\n\n```javascript\nangular.module('myApp', ['angular-medium-editor']);\n```\n\n## Documentation\n\nUse as an element:\n```html\n\u003cmedium-editor\u003e\u003c/medium-editor\u003e\n```\n\n...or attribute:\n```html\n\u003cp medium-editor\u003e\u003c/p\u003e\n```\n\nPass options with `bind-options` attribute:\n```html\n\u003cp medium-editor bind-options=\"options\"\u003e\u003c/p\u003e\n```\n\nSee MediumEditor's [options documentation](https://github.com/yabwe/medium-editor#mediumeditor-options) for details.\n\n## Examples\n\n#### Single line, no toolbar\nHeader example limited to one line and no toolbar\n```html\n\u003ch1 ng-model=\"title\" medium-editor bind-options=\"{disableReturn: true, disableExtraSpaces: true, toolbar: false}\" data-placeholder=\"Enter a title\"\u003e\u003c/h1\u003e\n```\n\n#### Multiline with custom toolbar\nParagraph with support for multiple lines and customized toolbar buttons\n```html\n\u003cp ng-model=\"description\" medium-editor bind-options=\"{'toolbar': {'buttons': ['bold', 'italic', 'underline']}}\" data-placeholder=\"Enter a description\"\u003e\u003c/p\u003e\n```\n\n#### Custom extension\nExample for extending the toolbar with customized element `highlighter` (using [rangy](https://github.com/timdown/rangy) and the [CSS Class Applier Module](https://code.google.com/p/rangy/wiki/CSSClassApplierModule) to support highlighting of text). For more detailed info on extensions, please refer to [MediumEditor](https://github.com/yabwe/medium-editor).\n```html\n\u003cp ng-model=\"text\" medium-editor bind-options=\"mediumBindOptions\"\u003e\u003c/p\u003e\n```\n```javascript\nfunction Highlighter() {\n  this.button = document.createElement('button');\n  this.button.className = 'medium-editor-action';\n  this.button.innerText = 'H';\n  this.button.onclick = this.onClick.bind(this);\n  this.classApplier = rangy.createCssClassApplier('highlight', {\n    elementTagName: 'mark',\n    normalize: true\n  });\n}\nHighlighter.prototype.onClick = function() {\n  this.classApplier.toggleSelection();\n};\nHighlighter.prototype.getButton = function() {\n  return this.button;\n};\nHighlighter.prototype.checkState = function(node) {\n  if (node.tagName == 'MARK') {\n    this.button.classList.add('medium-editor-button-active');\n  }\n};\n\nscope.mediumBindOptions = {\n  toolbar: {\n    buttons: ['bold', 'italic', 'highlight']\n  },\n  extensions: {\n    highlight: new Highlighter()\n  }\n};\n```\n\n## Running the demo\nIf you want to view the included demo, you have to run `bower` first in order to retrieve the dependencies.\n\n## License\nThe MIT License\n\nPermission 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:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE 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.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthijsw%2Fangular-medium-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthijsw%2Fangular-medium-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthijsw%2Fangular-medium-editor/lists"}