diff --git a/admin/editor-js.php b/admin/editor-js.php index 12267176..037e5185 100644 --- a/admin/editor-js.php +++ b/admin/editor-js.php @@ -42,7 +42,7 @@ $(document).ready(function () { redomac: '<?php _e('重做'); ?> - Ctrl+Shift+Z', fullscreen: '<?php _e('全屏'); ?> - Ctrl+M', - exitFullscreen: '<?php _e('退出全屏'); ?> - Ctrl+M', + exitFullscreen: '<?php _e('退出全屏'); ?> - Ctrl+E', fullscreenUnsupport: '<?php _e('此浏览器不支持全屏操作'); ?>', imagedialog: '<p><b><?php _e('插入图片'); ?></b></p><p><?php _e('请在下方的输入框内输入要插入的远程图片地址'); ?></p><p><?php _e('您也可以使用编辑器下方的文件上传功能插入本地图片'); ?></p>', @@ -127,10 +127,17 @@ $(document).ready(function () { var input = $('#text'), th = textarea.height(); - editor.hooks.chain('enterFullScreen', function () { + 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', window.screen.height - 46); + textarea.css('height', height - 52); + }); + + editor.hooks.chain('enterFullScreen', function () { + $(document.body).addClass('fullscreen'); + textarea.css('height', window.screen.height - 52); }); editor.hooks.chain('exitFullScreen', function () { 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 <hr> 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; } }; })(); 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'); <a href="<?php $options->adminUrl('write-page.php?cid=' . $pages->cid); ?>"><?php $pages->title(); ?></a> <?php if ($pages->hasSaved || 'page_draft' == $pages->type) { - echo '<em>(' . _t('草稿') . ')</em>'; + echo '<em class="status">' . _t('草稿') . '</em>'; } else if ('waiting' == $pages->status) { - echo '<em>(' . _t('待审核') . ')</em>'; + echo '<em class="status">' . _t('待审核') . '</em>'; } else if ('private' == $pages->status) { - echo '<em>(' . _t('私密') . ')</em>'; + echo '<em class="status">' . _t('私密') . '</em>'; } else if ($pages->password) { - echo '<em>(' . _t('密码保护') . ')</em>'; + echo '<em class="status">' . _t('密码保护') . '</em>'; } ?> <?php if ('page_draft' != $pages->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'] = ''; }