def onElementInitialized(self): # Issue 1897: This method is called after a timeout, during which time the # element might by detached. if not self.initializing: return print "onElementInit", DOM.getInnerHTML(self.beforeInitPlaceholder) self.initializing = False RichTextAreaImpl.onElementInitialized(self) # clone styles from main document if self.css_styling: elem = self.elem; _doc = elem.contentWindow.document fragment = _doc.createDocumentFragment() nl = doc().getElementsByTagName("style") for i in range(nl.length): n = nl.item(i) fragment.appendChild(n.cloneNode(True)) _doc.getElementsByTagName("head").item(0).appendChild(fragment) # When the iframe is ready, ensure cached content is set. if self.beforeInitPlaceholder is not None: self.setHTMLImpl(DOM.getInnerHTML(self.beforeInitPlaceholder)) self.beforeInitPlaceholder = None if self.isPendingFocus: self.isPendingFocus = False self.setFocus(True)
def __init__(self): RichTextAreaImpl.__init__(self) """* * Holds a cached copy of any user setHTML/setText actions until the real * text area is fully initialized. Becomes <code>None</code> after init. """ self.beforeInitPlaceholder = DOM.createDiv() """* * Set to True when the {@link RichTextArea} is attached to the page and * {@link #initElement()} is called. If the {@link RichTextArea} is detached * before {@link #onElementInitialized()} is called, this will be set to * False. See issue 1897 for details. """ self.initializing = False
def onElementInitialized(self): # Issue 1897: This method is called after a timeout, during which time the # element might by detached. if not self.initializing: return print "onElementInit", DOM.getInnerHTML(self.beforeInitPlaceholder) self.initializing = False RichTextAreaImpl.onElementInitialized(self) # When the iframe is ready, ensure cached content is set. if self.beforeInitPlaceholder is not None: self.setHTMLImpl(DOM.getInnerHTML(self.beforeInitPlaceholder)) self.beforeInitPlaceholder = None