prop('uid'))) $this->setProp('uid', uniqid()); $this->setDefaultProps(array('uploadUrl' => createLink('file', 'ajaxUpload', 'uid=' . $this->prop('uid')))); } /** * @param string $editor * @param string $type */ protected function buildTemplate($editor, $type) { global $app, $lang; $app->loadLang('user'); jsVar('templateEmpty', $lang->user->tplContentNotEmpty); jsVar('confirmDeleteTemplate', $lang->user->confirmDeleteTemplate); return btnGroup ( setClass('absolute right-0'), btn ( setClass('ghost border-l border-r border-light'), on::click("window.showSaveModal('$editor', '$type')"), $lang->user->saveTemplate ), dropdown ( btn($lang->user->applyTemplate, setClass('ghost')), set::items(array('url' => createLink('user', 'ajaxGetTemplates', "editor=$editor&type=$type"))) ) ); } protected function build() { global $config; $value = $this->prop('value'); $readonly = $this->prop('readonly'); $name = $this->prop('name'); $size = $this->prop('size'); $zuiPath = isset($config->zuiEditorPath) ? $config->zuiEditorPath : null; $zuiPathSetting = null; if($zuiPath) { $zuiPathSetting = js ( <<prop('downloadUrl'); if(is_null($downloadUrl)) $downloadUrl = createLink('file', 'ajaxQuery', 'fileID={gid}'); return div ( setClass('editor-container rounded relative w-full no-morph', $readonly ? 'is-readonly' : ''), $size === 'full' ? setStyle('height', '100%') : setClass('h-auto'), setCssVar('--affine-editor-side-padding', '0'), zui::pageEditor ( set::_class('w-full h-full'), set::name($name), set::htmlName($this->prop('htmlName')), set::uid($this->prop('uid')), set::content($value), set::readonly($readonly), set::downloadUrl($downloadUrl), set($this->getRestProps()) ), $zuiPathSetting ); } }