Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 1087020

Browse files
committedOct 20, 2015
Merge pull request #185 from angular-ui/v10-candidate
Pushing v10 to master for new release
2 parents 7fa0a49 + 285a5fb commit 1087020

File tree

6 files changed

+68
-14
lines changed

6 files changed

+68
-14
lines changed
 

‎.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
bower_components/
2-
node_modules/
2+
node_modules/
3+
/*.iml
4+
/.idea

‎CONTRIBUTING.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Got a question or problem?
2+
3+
Please, do not open issues for the general support questions as we want to keep GitHub issues for bug reports and feature requests. You've got much better chances of getting your question answered on [StackOverflow](http://stackoverflow.com/questions/tagged/angular-ui-tinymce) where maintainers are looking at questions questions tagged with `angular-ui-tinymce`.
4+
5+
StackOverflow is a much better place to ask questions since:
6+
* there are hundreds of people willing to help on StackOverflow
7+
* questions and answers stay available for public viewing so your question / answer might help someone else
8+
* SO voting system assures that the best answers are prominently visible.
9+
10+
To save your and our time we will be systematically closing all the issues that are requests for general support and redirecting people to StackOverflow.
11+
12+
## You think you've found a bug?
13+
14+
Oh, we are ashamed and want to fix it asap! But before fixing a bug we need to reproduce and confirm it. In order to reproduce bugs we will systematically ask you to provide a _minimal_ reproduce scenario using http://plnkr.co/. Having a live reproduce scenario gives us wealth of important information without going back & forth to you with additional questions like:
15+
* version of AngularJS used
16+
* version of this library that you are using
17+
* 3rd-party libraries used, if any
18+
* and most importantly - a use-case that fails
19+
20+
A minimal reproduce scenario using http://plnkr.co/ allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem.
21+
22+
We will be insisting on a minimal reproduce scenario in order to save maintainers time and ultimately be able to fix more bugs. Interestingly, from our experience users often find coding problems themselves while preparing a minimal plunk. We understand that sometimes it might be hard to extract essentials bits of code from a larger code-base but we really need to isolate the problem before we can fix it.
23+
24+
Unfortunately we are not able to investigate / fix bugs without a minimal reproduce scenario using http://plnkr.co/, so if we don't hear back from you we are going to close an issue that don't have enough info to be reproduced.
25+
26+
27+
## You want to contribute some code?
28+
29+
We are always looking for the quality contributions and will be happy to accept your Pull Requests as long as those adhere to some basic rules:
30+
31+
* Please open all pull requests against the `dev` branch.
32+
* Please assure that you are submitting quality code, specifically make sure that:
33+
* You have accompanying tests and all the tests are passing.
34+
* Your PR doesn't break the build; check the Travis-CI build status after opening a PR and push corrective commits if anything goes wrong
35+
* You are using 2 space indentation
36+
* Your commits conform to the conventions established [here](https://github.com/ajoslin/conventional-changelog/blob/master/conventions/angular.md)

‎README.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ bower install
3838
This will copy the ui-tinymce files into your `components` folder, along with its dependencies. Load the script files in your application:
3939

4040
```html
41-
<script type="text/javascript" src="app/bower_components/tinymce/tinymce.js"></script>
41+
<script type="text/javascript" src="app/bower_components/tinymce-dist/tinymce.js"></script>
4242
<script type="text/javascript" src="app/bower_components/angular/angular.js"></script>
43-
<script type="text/javascript" src="app/bower_components/angular-ui-tinymce/tinymce.js"></script>
43+
<script type="text/javascript" src="app/bower_components/angular-ui-tinymce/src/tinymce.js"></script>
4444
```
4545

4646
Add the tinymce module as a dependency to your application module:
@@ -69,6 +69,10 @@ If you add the ng-model directive to same the element as ui-tinymce then the tex
6969

7070
_The ui-tinymce directive stores the configuration options as specified in the [TinyMCE documentation](http://www.tinymce.com/wiki.php/Configuration) and expects the model value to be a html string or raw text, depending on whether `raw` is `true` (default value is `false`)._
7171

72+
**Note:** Make sure you using scopes correctly by following [this wiki page](https://github.com/angular/angular.js/wiki/Understanding-Scopes). If you are having issues with your model not updating, make sure you have a '.' in your model.
73+
74+
> 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.
75+
7276
## Options
7377

7478
The directive supports all of the standard TinyMCE initialization options as listed [here](http://www.tinymce.com/wiki.php/Configuration).
@@ -99,4 +103,11 @@ myAppModule.controller('MyController', function($scope) {
99103
<form method="post">
100104
<textarea ui-tinymce="tinymceOptions" ng-model="tinymceModel"></textarea>
101105
</form>
102-
```documentation
106+
```
107+
108+
----
109+
110+
111+
# Contributing to the project
112+
113+
We are always looking for the quality contributions! Please check the [CONTRIBUTING.md](CONTRIBUTING.md) for the contribution guidelines.

‎bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
],
1818
"dependencies": {
1919
"angular": "~1.x",
20-
"tinymce-dist": "~4.1.0"
20+
"tinymce-dist": "~4.2.0"
2121
},
2222
"devDependencies": {
2323
"angular-mocks": "~1.x"

‎src/tinymce.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ angular.module('ui.tinymce', [])
2121
var ngModel = ctrls[0],
2222
form = ctrls[1] || null;
2323

24-
var expression, options, tinyInstance,
24+
var expression, options = {}, tinyInstance,
2525
updateView = function(editor) {
2626
var content = editor.getContent({format: options.format}).trim();
2727
content = $sce.trustAsHtml(content);
@@ -42,7 +42,7 @@ angular.module('ui.tinymce', [])
4242
} else {
4343
ensureInstance();
4444

45-
if (tinyInstance) {
45+
if (tinyInstance && !tinyInstance.settings.readonly) {
4646
tinyInstance.getBody().setAttribute('contenteditable', true);
4747
}
4848
}
@@ -55,7 +55,7 @@ angular.module('ui.tinymce', [])
5555

5656
angular.extend(expression, scope.$eval(attrs.uiTinymce));
5757

58-
options = {
58+
var setupOptions = {
5959
// Update model when calling setContent
6060
// (such as from the source editor popup)
6161
setup: function(ed) {
@@ -74,7 +74,7 @@ angular.module('ui.tinymce', [])
7474
});
7575

7676
// Update model on change
77-
ed.on('change', function(e) {
77+
ed.on('change', function() {
7878
ed.save();
7979
updateView(ed);
8080
});
@@ -99,12 +99,12 @@ angular.module('ui.tinymce', [])
9999
});
100100
}
101101
},
102-
format: 'raw',
102+
format: expression.format || 'html',
103103
selector: '#' + attrs.id
104104
};
105105
// extend options with initial uiTinymceConfig and
106106
// options from directive attribute value
107-
angular.extend(options, uiTinymceConfig, expression);
107+
angular.extend(options, uiTinymceConfig, expression, setupOptions);
108108
// Wrapped in $timeout due to $tinymce:refresh implementation, requires
109109
// element to be present in DOM before instantiating editor when
110110
// re-rendering directive

‎test/tinymce.spec.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('uiTinymce', function () {
2323
* Asynchronously runs the compilation.
2424
*/
2525
function compile() {
26-
element = $compile('<form><textarea ui-tinymce="{foo: \'bar\', setup: setupFooBar() }" ng-model="foo"></textarea></form>')(scope);
26+
element = $compile('<form><textarea ui-tinymce="{foo: \'bar\', setup: setupFooBar }" data-ng-model="foo"></textarea></form>')(scope);
2727
angular.element(document.getElementsByTagName('body')[0]).append(element);
2828
scope.$apply();
2929
$timeout.flush();
@@ -53,10 +53,15 @@ describe('uiTinymce', function () {
5353
expect(tinymce.init.calls.mostRecent().args[0].tinymce.bar).toBe('baz');
5454
});
5555

56-
it('should execute the passed `setup` option', function() {
56+
it('should execute the passed `setup` option', function(done) {
5757
scope.setupFooBar = jasmine.createSpy('setupFooBar');
5858
compile();
59-
expect(scope.setupFooBar).toHaveBeenCalled();
59+
60+
//TODO: Get rid of timeout
61+
setTimeout(function() {
62+
expect(scope.setupFooBar).toHaveBeenCalled();
63+
done();
64+
}, 100);
6065
});
6166
});
6267

0 commit comments

Comments
 (0)