From 1cd85e5010c3f2d4e3b360aeffff56aaf1721886 Mon Sep 17 00:00:00 2001 From: joyqi Date: Fri, 1 Nov 2013 12:11:31 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fixed=20#46=20=E8=BF=99=E6=98=AF=E7=94=B1?= =?UTF-8?q?=E4=BA=8E=E5=88=A4=E6=96=AD=E7=B1=BB=E5=9E=8B=E7=9A=84bug?= =?UTF-8?q?=E9=80=A0=E6=88=90=E7=9A=84=E8=8D=89=E7=A8=BF=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E8=A2=AB=E8=AF=86=E5=88=AB=EF=BC=8C=E5=A6=82=E6=9E=9C=E8=BF=98?= =?UTF-8?q?=E6=9C=89=E9=97=AE=E9=A2=98=EF=BC=8C=E7=9B=B4=E6=8E=A5=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=A1=B5=E9=9D=A2=E7=84=B6=E5=90=8E=E9=87=8D=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/manage-pages.php | 8 ++++---- var/Widget/Contents/Post/Admin.php | 4 ++-- var/Widget/Contents/Post/Edit.php | 12 ++++++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/admin/manage-pages.php b/admin/manage-pages.php index 32be4535..a9a7f057 100644 --- a/admin/manage-pages.php +++ b/admin/manage-pages.php @@ -63,13 +63,13 @@ $stat = Typecho_Widget::widget('Widget_Stat'); title(); ?> hasSaved || 'page_draft' == $pages->type) { - echo '(' . _t('草稿') . ')'; + echo '' . _t('草稿') . ''; } else if ('waiting' == $pages->status) { - echo '(' . _t('待审核') . ')'; + echo '' . _t('待审核') . ''; } else if ('private' == $pages->status) { - echo '(' . _t('私密') . ')'; + echo '' . _t('私密') . ''; } else if ($pages->password) { - echo '(' . _t('密码保护') . ')'; + echo '' . _t('密码保护') . ''; } ?> type): ?> diff --git a/var/Widget/Contents/Post/Admin.php b/var/Widget/Contents/Post/Admin.php index fdb286bd..80621d33 100644 --- a/var/Widget/Contents/Post/Admin.php +++ b/var/Widget/Contents/Post/Admin.php @@ -61,8 +61,8 @@ class Widget_Contents_Post_Admin extends Widget_Abstract_Contents { $savedPost = $this->db->fetchRow($this->db->select('cid', 'modified') ->from('table.contents') - ->where('table.contents.parent = ? AND table.contents.type = ?', - $this->cid, 'post_draft') + ->where('table.contents.parent = ? AND (table.contents.type = ? OR table.contents.type = ?)', + $this->cid, 'post_draft', 'page_draft') ->limit(1)); if ($savedPost) { diff --git a/var/Widget/Contents/Post/Edit.php b/var/Widget/Contents/Post/Edit.php index c0bc161e..116d13c7 100644 --- a/var/Widget/Contents/Post/Edit.php +++ b/var/Widget/Contents/Post/Edit.php @@ -63,8 +63,8 @@ class Widget_Contents_Post_Edit extends Widget_Abstract_Contents implements Widg return $this->row; } else { return $this->db->fetchRow($this->widget('Widget_Abstract_Contents')->select() - ->where('table.contents.parent = ? AND table.contents.type = ?', - $this->cid, 'post_draft') + ->where('table.contents.parent = ? AND (table.contents.type = ? OR table.contents.type = ?)', + $this->cid, 'post_draft', 'page_draft') ->limit(1), array($this->widget('Widget_Abstract_Contents'), 'filter')); } } @@ -178,7 +178,9 @@ class Widget_Contents_Post_Edit extends Widget_Abstract_Contents implements Widg { /** 发布内容, 检查是否具有直接发布的权限 */ if ($this->user->pass('editor', true)) { - if ('password' == $contents['visibility'] || !in_array($contents['visibility'], array('private', 'waiting', 'publish'))) { + if (empty($contents['visibility'])) { + $contents['status'] = 'publish'; + } else if ('password' == $contents['visibility'] || !in_array($contents['visibility'], array('private', 'waiting', 'publish'))) { if (empty($contents['password']) || 'password' != $contents['visibility']) { $contents['password'] = ''; } @@ -248,7 +250,9 @@ class Widget_Contents_Post_Edit extends Widget_Abstract_Contents implements Widg { /** 发布内容, 检查是否具有直接发布的权限 */ if ($this->user->pass('editor', true)) { - if ('password' == $contents['visibility'] || !in_array($contents['visibility'], array('private', 'waiting', 'publish'))) { + if (empty($contents['visibility'])) { + $contents['status'] = 'publish'; + } else if ('password' == $contents['visibility'] || !in_array($contents['visibility'], array('private', 'waiting', 'publish'))) { if (empty($contents['password']) || 'password' != $contents['visibility']) { $contents['password'] = ''; } From a80a67a520038cd186bcbc1f203a1be0337eea00 Mon Sep 17 00:00:00 2001 From: joyqi Date: Fri, 1 Nov 2013 12:50:40 +0800 Subject: [PATCH 2/3] fixed #45 --- admin/editor-js.php | 9 +++++++-- admin/js/markdown.js | 35 +++++++++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/admin/editor-js.php b/admin/editor-js.php index 12267176..c72f3081 100644 --- a/admin/editor-js.php +++ b/admin/editor-js.php @@ -42,7 +42,7 @@ $(document).ready(function () { redomac: ' - Ctrl+Shift+Z', fullscreen: ' - Ctrl+M', - exitFullscreen: ' - Ctrl+M', + exitFullscreen: ' - Ctrl+E', fullscreenUnsupport: '', imagedialog: '

', @@ -127,8 +127,13 @@ $(document).ready(function () { var input = $('#text'), th = textarea.height(); - editor.hooks.chain('enterFullScreen', function () { + editor.hooks.chain('enterFakeFullScreen', function () { th = textarea.height(); + $(document.body).addClass('fullscreen'); + textarea.css('height', document.body.clientHeight - 46 - 1); + }); + + editor.hooks.chain('enterFullScreen', function () { $(document.body).addClass('fullscreen'); textarea.css('height', window.screen.height - 46); }); diff --git a/admin/js/markdown.js b/admin/js/markdown.js index d1fe682e..16ae3290 100644 --- a/admin/js/markdown.js +++ b/admin/js/markdown.js @@ -3068,7 +3068,7 @@ else headingexample: "Heading", fullscreen: 'FullScreen Ctrl+M', - exitFullscreen: 'Exit FullScreen Ctrl+M', + exitFullscreen: 'Exit FullScreen Ctrl+E', fullscreenUnsupport: 'Sorry, the browser dont support fullscreen api', hr: "Horizontal Rule
Ctrl+R", @@ -3153,6 +3153,7 @@ else * image url (or null if the user cancelled). If this hook returns false, the default dialog will be used. */ hooks.addNoop("enterFullScreen"); + hooks.addNoop("enterFakeFullScreen"); hooks.addNoop("exitFullScreen"); this.getConverter = function () { return markdownConverter; } @@ -4318,6 +4319,9 @@ else case 'm': doClick(buttons.fullscreen); break; + case 'e': + doClick(buttons.exitFullscreen); + break; case "h": doClick(buttons.heading); break; @@ -4565,10 +4569,10 @@ else buttons.redo = makeButton("wmd-redo-button", redoTitle, "-220px", null); buttons.redo.execute = function (manager) { if (manager) manager.redo(); }; buttons.fullscreen = makeButton("wmd-fullscreen-button", getString("fullscreen"), "-240px", null); - buttons.fullscreen.execute = function () { fullScreenManager.doFullScreen(buttons); }; + buttons.fullscreen.execute = function () { fullScreenManager.doFullScreen(buttons, true); }; buttons.exitFullscreen = makeButton("wmd-exit-fullscreen-button", getString("exitFullscreen"), "-260px", null); buttons.exitFullscreen.style.display = 'none'; - buttons.exitFullscreen.execute = function () { fullScreenManager.doFullScreen(buttons); }; + buttons.exitFullscreen.execute = function () { fullScreenManager.doFullScreen(buttons, false); }; if (helpOptions) { var helpButton = document.createElement("li"); @@ -5295,6 +5299,7 @@ else this.fullScreenBind = false; this.hooks = hooks; this.getString = getString; + this.isFakeFullScreen = false; } function getFullScreenAdapter () { @@ -5332,8 +5337,8 @@ else document.msIsFullScreen; }; - // fullscreen - FullScreenManager.prototype.doFullScreen = function (buttons) { + // fullscreen + FullScreenManager.prototype.doFullScreen = function (buttons, enter) { var adapter = getFullScreenAdapter(), self = this; if (!adapter) { @@ -5357,11 +5362,25 @@ else this.fullScreenBind = true; } - if (!isFullScreen()) { - document.body[adapter.requestFullscreen]('webkitRequestFullScreen' == adapter.requestFullscreen + if (enter) { + if (self.isFakeFullScreen) { + document.body[adapter.requestFullscreen]('webkitRequestFullScreen' == adapter.requestFullscreen ? Element.ALLOW_KEYBOARD_INPUT : null); + self.isFakeFullScreen = false; + } else { + buttons.exitFullscreen.style.display = ''; + self.hooks.enterFakeFullScreen(); + self.isFakeFullScreen = true; + } } else { - document[adapter.cancelFullscreen](); + if (self.isFakeFullScreen) { + buttons.exitFullscreen.style.display = 'none'; + self.hooks.exitFullScreen(); + } else { + document[adapter.cancelFullscreen](); + } + + self.isFakeFullScreen = false; } }; })(); From b0967310419beeaedb5ddeb661087b47c1933a92 Mon Sep 17 00:00:00 2001 From: joyqi Date: Fri, 1 Nov 2013 19:42:19 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/editor-js.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/admin/editor-js.php b/admin/editor-js.php index c72f3081..037e5185 100644 --- a/admin/editor-js.php +++ b/admin/editor-js.php @@ -128,14 +128,16 @@ $(document).ready(function () { var input = $('#text'), th = textarea.height(); editor.hooks.chain('enterFakeFullScreen', function () { + var height = Math.max(document.documentElement.clientHeight, document.body.clientHeight); + th = textarea.height(); $(document.body).addClass('fullscreen'); - textarea.css('height', document.body.clientHeight - 46 - 1); + textarea.css('height', height - 52); }); editor.hooks.chain('enterFullScreen', function () { $(document.body).addClass('fullscreen'); - textarea.css('height', window.screen.height - 46); + textarea.css('height', window.screen.height - 52); }); editor.hooks.chain('exitFullScreen', function () {