Beispiel #1
0
    def _attachSummernote(self, retry=0):
        elem = self.summernoteContainer.element
        lang = conf["currentLanguage"]

        try:
            self.summernote = summernoteEditor(elem, lang)
        except:
            if retry >= 3:
                html5.ext.Alert(
                    "Unable to connect summernote, please contact technical support..."
                )
                return

            logging.debug(
                "Summernote initialization failed, retry will start in 1sec")
            DeferredCall(self._attachSummernote, retry=retry + 1, _delay=1000)
            return

        imagebtn = TextInsertImageAction(summernote=self.summernote,
                                         boneName=self.boneName)
        self.parent().appendChild(imagebtn)

        if not self.enabled:
            self.summernote.summernote("disable")

        if self.value:
            self["value"] = self.value
Beispiel #2
0
    def onLoad(self, *args, **kwargs):
        """
			Internal callback - The state of our upload changed.
		"""
        if self.xhr.status in [200, 204]:
            NetworkService.request("file",
                                   "add", {
                                       "key": self.targetKey,
                                       "node": self.node,
                                       "skelType": "leaf"
                                   },
                                   successHandler=self.onUploadAdded,
                                   secure=True)
        else:
            DeferredCall(self.onFailed, self.xhr.status, _delay=1000)
Beispiel #3
0
	def onUploadAdded(self, req):
		self.responseValue = NetworkService.decode(req)
		DeferredCall(self.onSuccess, _delay=1000)