Comments (3)
just checkout my demo: https://killercodemonkey.github.io/ng-quill/demo.html search for readonly
it is working quite well there.
from ng-quill.
Yes, in your example everything works. But in my plunker value of read-only
attribure is set to true in $watch
function (right after $init
, but before quill initialization: you can open console and make sure of it). This is another case when readonly does not work. After some research I found out that problem is in this code in $onChanges
hook:
if (editor && changes.readOnly) {
editor.enable(!changes.readOnly.currentValue)
}
The code in plunker is executed in the following sequence:
$onInit
hook of my component is called,vm.readOnly
is set to its initial value (false);$onChanges
hook of ng-quill is called, and does almost nothing, because quill has not been initialized andeditor
variable is undefined;$onInit
hook of ng-quill is called, and setsreadonly
field inconfig
variable to false;$postLink
hook of ng-quill is called, and schedules_initEditor
function calling;$watch
function of my component is called and setsvm.readOnly
to true;$onChanges
hook of ng-quill is called, and does nothing once more, because quill is still not initialized. But it had to setreadOnly
field inconfig
variable because of changes in (5)_initEditor
function of ng-quill is called, and quill is initialized with wrong readOnly value
from ng-quill.
yep and that is something you should avoid.
just change your code a little bit and use timeout:
$scope.$watch('doesntMatterWhat', function() {
$timeout(function () {
vm.readOnly = true;
console.log('Flag changed!')
})
})
or just wait for the editor to be created, so use the onEditorCreated callback.
all in all you should avoid watchers ;)
from ng-quill.
Related Issues (20)
- Toolbar at the bottom HOT 2
- Hardcoded quill.js link in snow theme HOT 1
- max-length and min-length attributes does not work properly for non-empty model HOT 1
- Quill editor content is not equal to ngModel value after pasting unsupported content into quill HOT 6
- Html Tag Attributs Removed HOT 9
- Version Issue HOT 2
- Font-sizes not working HOT 1
- Locks all the events after one successful redirect. HOT 1
- can not display successfully HOT 2
- rel="noopener noreferrer" on links when text is processed with ng-quill HOT 2
- Set Optional Data via Formly HOT 1
- onEditorCreated not updating HOT 1
- Add BSV as donation address. HOT 1
- Came here to deliver kudos HOT 2
- Global event handler HOT 1
- On-Content-Changed event firing on load HOT 3
- Is there a way to initialize the ng-quill content before it is there in the DOM HOT 1
- Any way to focus quill editor onLoad? HOT 2
- 'ng-quill-toolbar' is not a known element HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ng-quill.