#11772 closed defect (fixed)
Editor addStyleSheet adds the stylesheet to the wrong scope
Reported by: | Katie Vance | Owned by: | Jared Jurkiewicz |
---|---|---|---|
Priority: | high | Milestone: | 1.6 |
Component: | Editor | Version: | 1.5 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
The addStyleSheet method is adding the stylesheet to the top level document. Instead, shouldn't it add the stylesheet to the editor's document?
This can be seen by clicking the buttons in the test_RichText.html test. At first it appears that the remove is broken, however, it is really the add because once the stylesheet is added, you can see it modifies the h1 element at the top level, not the h1 element in the editor.
Attaching a patch...
Attachments (1)
Change History (5)
Changed 10 years ago by
Attachment: | Editor_addStylesheet.patch added |
---|
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
Index: RichText.js =================================================================== --- RichText.js (revision 22883) +++ RichText.js (working copy) @@ -636,7 +636,7 @@ } this.editingAreaStyleSheets.push(url); - this.onLoadDeferred.addCallback(dojo.hitch(function(){ + this.onLoadDeferred.addCallback(dojo.hitch(this, function(){ if(this.document.createStyleSheet){ //IE this.document.createStyleSheet(url); }else{ //other browser
Is simpler and I believe will solve it fine.
comment:3 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 Changed 10 years ago by
Milestone: | tbd → 1.6 |
---|
Note: See
TracTickets for help on using
tickets.
The fix is simpler than your patch, actually.
this.onLoadDeferred.addCallback(dojo.hitch(this, function(){...
Would do it. The hitch was missing the scope (Eg, the editor), when being set.