加入退出全屏按钮

This commit is contained in:
joyqi 2013-10-25 11:34:57 +08:00
parent 7c6b067f59
commit 0523a7e3ac
2 changed files with 15 additions and 3 deletions

View File

@ -3068,6 +3068,7 @@ else
headingexample: "Heading",
fullscreen: 'FullScreen Ctrl+M',
exitFullscreen: 'Exit FullScreen Ctrl+M',
hr: "Horizontal Rule <hr> Ctrl+R",
@ -4563,7 +4564,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.fullscreen.execute = function () { fullScreenManager.doFullScreen(buttons); };
buttons.exitFullscreen = makeButton("wmd-exit-fullscreen-button", getString("exitFullscreen"), "-260px", null);
buttons.exitFullscreen.style.display = 'none';
buttons.exitFullscreen.execute = function () { fullScreenManager.doFullScreen(buttons); };
if (helpOptions) {
var helpButton = document.createElement("li");
@ -4571,7 +4575,7 @@ else
helpButton.appendChild(helpButtonImage);
helpButton.className = "wmd-button wmd-help-button";
helpButton.id = "wmd-help-button" + postfix;
helpButton.XShift = "-240px";
helpButton.XShift = "-280px";
helpButton.isHelp = true;
helpButton.style.right = "0px";
helpButton.title = getString("help");
@ -5326,7 +5330,7 @@ else
};
// fullscreen
FullScreenManager.prototype.doFullScreen = function (chunk, postProcessing) {
FullScreenManager.prototype.doFullScreen = function (buttons) {
var adapter = getFullScreenAdapter(), self = this;
if (!adapter) {
@ -5346,9 +5350,15 @@ else
}
if (!isFullScreen()) {
buttons.fullscreen.style.display = 'none';
buttons.exitFullscreen.style.display = '';
document.body[adapter.requestFullscreen]('webkitRequestFullScreen' == adapter.requestFullscreen
? Element.ALLOW_KEYBOARD_INPUT : null);
} else {
buttons.fullscreen.style.display = '';
buttons.exitFullscreen.style.display = 'none';
document[adapter.cancelFullscreen]();
}
};

View File

@ -240,6 +240,7 @@ $(document).ready(function () {
redomac: '<?php _e('重做'); ?> - Ctrl+Shift+Z',
fullscreen: '<?php _e('全屏'); ?> - Ctrl+M',
exitFullscreen: '<?php _e('退出全屏'); ?> - Ctrl+M',
imagedialog: '<p><b><?php _e('插入图片'); ?></b></p><p><?php _e('请在下方的输入框内输入要插入的远程图片地址'); ?></p><p><?php _e('您也可以使用编辑器下方的文件上传功能插入本地图片'); ?></p>',
linkdialog: '<p><b><?php _e('插入链接'); ?></b></p><p><?php _e('请在下方的输入框内输入要插入的链接地址'); ?></p>',
@ -302,6 +303,7 @@ $(document).ready(function () {
editor.hooks.chain('enterFullScreen', function () {
$(document.body).addClass('fullscreen');
$('#wmd-fullscreen-button span').css('background-position', '-240px -20px');
});
editor.hooks.chain('exitFullScreen', function () {