Installations
npm install @priotas/angular-ui-tinymce
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
8.11.3
NPM Version
5.6.0
Score
72.1
Supply Chain
98.4
Quality
74.8
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
priotas
Download Statistics
Total Downloads
3,199
Last Day
1
Last Week
24
Last Month
55
Last Year
438
GitHub Statistics
180 Commits
2 Watching
6 Branches
Bundle Size
2.41 kB
Minified
1.14 kB
Minified + Gzipped
Package Meta Information
Latest Version
0.1.20
Package Id
@priotas/angular-ui-tinymce@0.1.20
Unpacked Size
29.92 kB
Size
10.46 kB
File Count
15
NPM Version
5.6.0
Node Version
8.11.3
Total Downloads
Cumulative downloads
Total Downloads
3,199
Last day
-50%
1
Compared to previous day
Last week
60%
24
Compared to previous week
Last month
-12.7%
55
Compared to previous month
Last year
77.3%
438
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
UI Tinymce - AngularJS directive for TinyMCE.
Call for Maintainer
This library is looking for a maintainer. If you feel up to the task please open an issue indicating so.
Requirements
- AngularJS 1.4.x or higher and it has been tested with Angular 1.4.8.
- TinyMCE 4
Testing
We use karma and jshint to ensure the quality of the code. The easiest way to run these checks is to use grunt:
npm install -g grunt-cli
npm install
bower install
grunt
The karma task will try to open Chrome as a browser in which to run the tests. Make sure this is available or change the configuration in test\test.config.js
Usage
We use bower for dependency management. Add
dependencies: {
"angular-ui-tinymce": "latest"
}
To your bower.json
file. Then run
bower install
This will copy the ui-tinymce files into your components
folder, along with its dependencies. Load the script files in your application:
1<script type="text/javascript" src="app/bower_components/tinymce/tinymce.js"></script> 2<script type="text/javascript" src="app/bower_components/angular/angular.js"></script> 3<script type="text/javascript" src="app/bower_components/angular-ui-tinymce/src/tinymce.js"></script>
Add the tinymce module as a dependency to your application module:
1var myAppModule = angular.module('MyApp', ['ui.tinymce'])
Apply the directive to your form elements:
1<form method="post"> 2 <textarea ui-tinymce ng-model="tinymceModel"></textarea> 3</form>
Be sure not to set an id
attribute. This is because the directive needs to maintain selector knowledge in order to handle buggy behavior in TinyMCE when DOM manipulation is involved, such as in a reordering of HTML through ng-repeat or DOM destruction/recreation through ng-if.
When using other directives which do DOM manipulation involving elements with ui-tinymce
, you may need to re-render the editor due to this buggy behavior with TinyMCE. For those situations, it is recommended to use the $tinymce:refresh
event, which will handle re-rendering the editor to fix this problem.
Working with ng-model
The ui-tinymce directive plays nicely with the ng-model directive such as ng-required.
If you add the ng-model directive to same the element as ui-tinymce then the text in the editor is automatically synchronized with the model value.
The ui-tinymce directive stores the configuration options as specified in the TinyMCE documentation and expects the model value to be a html string or raw text, depending on whether raw
is true
(default value is false
).
Note: Make sure you using scopes correctly by following this wiki page. If you are having issues with your model not updating, make sure you have a '.' in your model.
This issue with primitives can be easily avoided by following the "best practice" of always have a '.' in your ng-models – watch 3 minutes worth. Misko demonstrates the primitive binding issue with ng-switch.
Options
The directive supports all of the standard TinyMCE initialization options as listed here.
Use the setup function to bind different events:
1scope.tinymceOptions = { 2 setup: function(editor) { 3 //Focus the editor on load 4 $timeout(function(){ editor.focus(); }); 5 editor.on("init", function() { 6 ... 7 }); 8 editor.on("click", function() { 9 ... 10 }); 11 } 12};
By default all TinyMCE content that is set to ngModel
will be whitelisted by $sce
.
In addition, it supports these additional optional options
format
Format to get content as, i.e. 'raw' for raw HTML, or 'text' for text only. Defaults to 'html'. Documentation herebaseURL
This will set baseURL property on the EditorManagerdebounce
This will debounce the model update which helps with performance of editors with large text. Defaults to true.
This option is only supported when present on the uiTinymceConfig
global injectable - this injectable needs to be an object.
baseUrl
Sets the base url used by tinymce asset loading
1myAppModule.controller('MyController', function($scope) { 2 $scope.tinymceOptions = { 3 onChange: function(e) { 4 // put logic here for keypress and cut/paste changes 5 }, 6 inline: false, 7 plugins : 'advlist autolink link image lists charmap print preview', 8 skin: 'lightgray', 9 theme : 'modern' 10 }; 11});
1<form method="post"> 2 <textarea ui-tinymce="tinymceOptions" ng-model="tinymceModel"></textarea> 3</form>
Testing your Application (Protractor)
If you are testing your application using Protractor and you wish to be able to automate the
contribution of rich text content as part of the tests, use the TinyMCE API method insertContent
in conjunction with the WebDriver's executeScript
method, like this:
1browser.driver.executeScript("tinyMCE.activeEditor.insertContent('This is <em>RICH</em> content')");
Note that if you use the TinyMCE API method setContent
, this will fail to update the Angular model
with the entered content, so use insertContent
instead.
Contributing to the project
We are always looking for the quality contributions! Please check the CONTRIBUTING.md for the contribution guidelines.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/29 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'priotas'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 2 are checked with a SAST tool
Score
3
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More