3131 </ style >
3232
3333 <!-- Scripts -->
34- < script type ="text/javascript " src ="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5 /angular.min.js "> </ script >
35- < script type ="text/javascript " src ="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5 /angular-sanitize.min.js "> </ script >
34+ < script type ="text/javascript " src ="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.7 /angular.min.js "> </ script >
35+ < script type ="text/javascript " src ="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.7 /angular-sanitize.min.js "> </ script >
3636 < script type ="text/javascript " src ="//cdn.quilljs.com/1.3.6/quill.js "> </ script >
3737 < script type ="text/javascript " src ="src/ng-quill.js "> </ script >
3838 < script >
6161 } , 2000 )
6262 $scope . model = ''
6363 $scope . required = 'required'
64- $scope . modelJSON = [
64+ $scope . modelJSON = { ops : [
6565 { insert : 'Hello ' } ,
6666 { insert : 'World!' , attributes : { bold : true } } ,
6767 { insert : '\n' }
68- ]
68+ ] }
69+ $scope . changeJSON = function ( ) {
70+ $scope . modelJSON = $scope . modelJSON ? $scope . modelJSON : { ops : [ ] }
71+ const modelJSON = JSON . parse ( JSON . stringify ( $scope . modelJSON ) )
72+ modelJSON . ops . unshift ( { insert : 'Changed! ' } )
73+ $scope . modelJSON = modelJSON
74+ }
6975 $scope . modelText = 'Hello World'
7076 $scope . readOnly = false
7177 $scope . test = ''
9197 $scope . editorCreated = function ( editor ) {
9298 console . log ( editor )
9399 }
94- $scope . contentChanged = function ( editor , html , text , content , delta , oldDelta , source ) {
95- console . log ( 'editor: ' , editor , 'html: ' , html , 'text:' , text , 'content:' , content , 'delta: ' , delta , 'oldDelta:' , oldDelta , 'source:' , source )
100+ $scope . contentChanged = function ( data ) {
101+ console . log ( 'editor: ' , data . editor , 'html: ' , data . html , 'text:' , data . text , 'content:' , data . content , 'delta: ' , data . delta , 'oldDelta:' , data . oldDelta , 'source:' , data . source )
96102 }
97- $scope . selectionChanged = function ( editor , range , oldRange , source ) {
98- console . log ( 'editor: ' , editor , 'range: ' , range , 'oldRange:' , oldRange , 'source:' , source )
103+ $scope . selectionChanged = function ( data ) {
104+ console . log ( 'editor: ' , data . editor , 'range: ' , data . range , 'oldRange:' , data . oldRange , 'source:' , data . source )
99105 }
100106 }
101107 ] )
@@ -107,6 +113,7 @@ <h3>Default editor + Callbacks/Outputs in JS console</h3>
107113 < ng-quill-editor bounds ="self " ng-model ="title " placeholder ="'override default placeholder' " on-editor-created ="editorCreated(editor) " on-content-changed ="contentChanged(editor, html, text, content) " on-selection-changed ="selectionChanged(editor, range, oldRange, source) "> </ ng-quill-editor >
108114
109115 < h3 > Default editor + Callbacks/Outputs in JS console and empty init model + Object-Format</ h3 >
116+ < button ng-click ="changeJSON() "> Change the model!</ button >
110117 < pre > < code > {{modelJSON}}</ code > </ pre >
111118 < ng-quill-editor format ="object " custom-options ="customTag " ng-model ="modelJSON " placeholder ="'override default placeholder' " on-editor-created ="editorCreated(editor) " on-content-changed ="contentChanged(editor, html, text, content) " on-selection-changed ="selectionChanged(editor, range, oldRange, source) "> </ ng-quill-editor >
112119
@@ -144,31 +151,30 @@ <h3>ng-quill - custom toolbar (position: bottom)</h3>
144151 placeholder ="'' "
145152 custom-toolbar-position ="bottom "
146153 >
147- < ng-quill-toolbar >
148- < div id ="ng-quill-toolbar ">
149- < span class ="ql-formats ">
150- < button class ="ql-bold " ng-attr-title ="{{'Bold'}} "> </ button >
151- </ span >
152- < span class ="ql-formats ">
153- < select class ="ql-align " ng-attr-title ="{{'Aligment'}} ">
154- < option selected > </ option >
155- < option value ="center "> </ option >
156- < option value ="right "> </ option >
157- < option value ="justify "> </ option >
158- </ select >
159- < select class ="ql-align ">
160- < option selected > </ option >
161- < option value ="center "> </ option >
162- < option value ="right "> </ option >
163- < option value ="justify "> </ option >
164- </ select >
165- </ span >
166- </ div >
167- </ ng-quill-toolbar >
168- </ ng-quill-editor >
169-
170- < h3 > Custom font sizes</ h3 >
171- < ng-quill-editor ng-model ="title " custom-options ="customOptions " modules ="customModules "> </ ng-quill-editor >
172-
154+ < ng-quill-toolbar >
155+ < div id ="ng-quill-toolbar ">
156+ < span class ="ql-formats ">
157+ < button class ="ql-bold " ng-attr-title ="{{'Bold'}} "> </ button >
158+ </ span >
159+ < span class ="ql-formats ">
160+ < select class ="ql-align " ng-attr-title ="{{'Aligment'}} ">
161+ < option selected > </ option >
162+ < option value ="center "> </ option >
163+ < option value ="right "> </ option >
164+ < option value ="justify "> </ option >
165+ </ select >
166+ < select class ="ql-align ">
167+ < option selected > </ option >
168+ < option value ="center "> </ option >
169+ < option value ="right "> </ option >
170+ < option value ="justify "> </ option >
171+ </ select >
172+ </ span >
173+ </ div >
174+ </ ng-quill-toolbar >
175+ </ ng-quill-editor >
176+
177+ < h3 > Custom font sizes</ h3 >
178+ < ng-quill-editor ng-model ="title " custom-options ="customOptions " modules ="customModules "> </ ng-quill-editor >
173179 </ body >
174180</ html >
0 commit comments