Merge branch 'master' of https://github.com/typecho/typecho
This commit is contained in:
@@ -166,6 +166,8 @@ $(document).ready(function () {
|
||||
}
|
||||
});
|
||||
|
||||
<?php Typecho_Plugin::factory('admin/editor-js.php')->markdownEditor($content); ?>
|
||||
|
||||
var input = $('#text'), th = textarea.height(), ph = preview.height();
|
||||
|
||||
editor.hooks.chain('enterFakeFullScreen', function () {
|
||||
|
||||
+134
-2
@@ -1666,6 +1666,9 @@ else
|
||||
* its own image insertion dialog, this hook should return true, and the callback should be called with the chosen
|
||||
* image url (or null if the user cancelled). If this hook returns false, the default dialog will be used.
|
||||
*/
|
||||
|
||||
hooks.addNoop("makeButton");
|
||||
|
||||
hooks.addNoop("enterFullScreen");
|
||||
hooks.addNoop("enterFakeFullScreen");
|
||||
hooks.addNoop("exitFullScreen");
|
||||
@@ -1699,7 +1702,7 @@ else
|
||||
}
|
||||
|
||||
fullScreenManager = new FullScreenManager(hooks, getString);
|
||||
uiManager = new UIManager(idPostfix, panels, undoManager, previewManager, commandManager, fullScreenManager, options.helpButton, getString);
|
||||
uiManager = new UIManager(idPostfix, panels, hooks, undoManager, previewManager, commandManager, fullScreenManager, options.helpButton, getString);
|
||||
uiManager.setUndoRedoButtonStates();
|
||||
|
||||
var forceRefresh = that.refreshPreview = function () { previewManager.refresh(true); };
|
||||
@@ -2614,6 +2617,132 @@ else
|
||||
return background;
|
||||
};
|
||||
|
||||
// 扩展了原来ui的功能
|
||||
// 允许创建一个自定义html的对话框
|
||||
ui.dialog = function (html, callback, ok, cancel) {
|
||||
|
||||
// These variables need to be declared at this level since they are used
|
||||
// in multiple functions.
|
||||
var dialog; // The dialog box.
|
||||
|
||||
// Used as a keydown event handler. Esc dismisses the prompt.
|
||||
// Key code 27 is ESC.
|
||||
var checkEscape = function (key) {
|
||||
var code = (key.charCode || key.keyCode);
|
||||
if (code === 27) {
|
||||
close(true);
|
||||
}
|
||||
};
|
||||
|
||||
// Dismisses the hyperlink input box.
|
||||
// isCancel is true if we don't care about the input text.
|
||||
// isCancel is false if we are going to keep the text.
|
||||
var close = function (isCancel) {
|
||||
util.removeEvent(doc.body, "keydown", checkEscape);
|
||||
dialog.parentNode.removeChild(dialog);
|
||||
|
||||
callback(isCancel);
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Create the text input box form/window.
|
||||
var createDialog = function () {
|
||||
|
||||
// The main dialog box.
|
||||
dialog = doc.createElement("div");
|
||||
dialog.className = "wmd-prompt-dialog";
|
||||
dialog.setAttribute("role", "dialog");
|
||||
/*
|
||||
dialog.style.padding = "10px;";
|
||||
dialog.style.position = "fixed";
|
||||
dialog.style.width = "400px";
|
||||
dialog.style.zIndex = "1001";
|
||||
*/
|
||||
|
||||
// The dialog text.
|
||||
var question = doc.createElement("div");
|
||||
|
||||
// The web form container for the text box and buttons.
|
||||
var form = doc.createElement("form"),
|
||||
style = form.style;
|
||||
form.onsubmit = function () { return close(false); };
|
||||
/*
|
||||
style.padding = "0";
|
||||
style.margin = "0";
|
||||
style.cssFloat = "left";
|
||||
style.width = "100%";
|
||||
style.textAlign = "center";
|
||||
style.position = "relative";
|
||||
*/
|
||||
dialog.appendChild(form);
|
||||
form.appendChild(question);
|
||||
|
||||
if ('function' == typeof(html)) {
|
||||
html.call(this, question);
|
||||
} else {
|
||||
question.innerHTML = html;
|
||||
}
|
||||
|
||||
// The ok button
|
||||
var okButton = doc.createElement("button");
|
||||
okButton.type = "button";
|
||||
okButton.className = "btn-s primary";
|
||||
okButton.onclick = function () { return close(false); };
|
||||
okButton.innerHTML = ok;
|
||||
/*
|
||||
style = okButton.style;
|
||||
style.margin = "10px";
|
||||
style.display = "inline";
|
||||
style.width = "7em";
|
||||
*/
|
||||
|
||||
// The cancel button
|
||||
var cancelButton = doc.createElement("button");
|
||||
cancelButton.type = "button";
|
||||
cancelButton.className = "btn-s";
|
||||
cancelButton.onclick = function () { return close(true); };
|
||||
cancelButton.innerHTML = cancel;
|
||||
/*
|
||||
style = cancelButton.style;
|
||||
style.margin = "10px";
|
||||
style.display = "inline";
|
||||
style.width = "7em";
|
||||
*/
|
||||
|
||||
form.appendChild(okButton);
|
||||
form.appendChild(cancelButton);
|
||||
|
||||
util.addEvent(doc.body, "keydown", checkEscape);
|
||||
/*
|
||||
dialog.style.top = "50%";
|
||||
dialog.style.left = "50%";
|
||||
dialog.style.display = "block";
|
||||
if (uaSniffed.isIE_5or6) {
|
||||
dialog.style.position = "absolute";
|
||||
dialog.style.top = doc.documentElement.scrollTop + 200 + "px";
|
||||
dialog.style.left = "50%";
|
||||
}
|
||||
*/
|
||||
doc.body.appendChild(dialog);
|
||||
|
||||
// This has to be done AFTER adding the dialog to the form if you
|
||||
// want it to be centered.
|
||||
/*
|
||||
dialog.style.marginTop = -(position.getHeight(dialog) / 2) + "px";
|
||||
dialog.style.marginLeft = -(position.getWidth(dialog) / 2) + "px";
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
// Why is this in a zero-length timeout?
|
||||
// Is it working around a browser bug?
|
||||
setTimeout(function () {
|
||||
createDialog();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// This simulates a modal dialog box and asks for the URL when you
|
||||
// click the hyperlink or image buttons.
|
||||
//
|
||||
@@ -2788,7 +2917,7 @@ else
|
||||
}, 0);
|
||||
};
|
||||
|
||||
function UIManager(postfix, panels, undoManager, previewManager, commandManager, fullScreenManager, helpOptions, getString) {
|
||||
function UIManager(postfix, panels, hooks, undoManager, previewManager, commandManager, fullScreenManager, helpOptions, getString) {
|
||||
|
||||
var inputBox = panels.input,
|
||||
buttons = {}; // buttons.undo, buttons.link, etc. The actual DOM elements.
|
||||
@@ -3094,6 +3223,9 @@ else
|
||||
buttons.exitFullscreen.style.display = 'none';
|
||||
buttons.exitFullscreen.execute = function () { fullScreenManager.doFullScreen(buttons, false); };
|
||||
|
||||
// button hooks
|
||||
hooks.makeButton(buttons, makeButton, bindCommand, ui);
|
||||
|
||||
if (helpOptions) {
|
||||
var helpButton = document.createElement("li");
|
||||
var helpButtonImage = document.createElement("span");
|
||||
|
||||
@@ -110,7 +110,8 @@ class Typecho_Validate
|
||||
// Cycle through the rules and test for errors
|
||||
foreach ($rules as $key => $rules) {
|
||||
$this->_key = $key;
|
||||
$data[$key] = (0 == strlen($data[$key])) ? NULL : $data[$key];
|
||||
$data[$key] = (is_array($data[$key]) ? 0 == count($data[$key])
|
||||
: 0 == strlen($data[$key])) ? NULL : $data[$key];
|
||||
|
||||
foreach ($rules as $params) {
|
||||
$method = $params[0];
|
||||
|
||||
@@ -148,7 +148,7 @@ class Widget_Options_General extends Widget_Abstract_Options implements Widget_I
|
||||
}
|
||||
|
||||
$settings = $this->request->from('title', 'siteUrl', 'description', 'keywords', 'allowRegister', 'timezone', 'attachmentTypes');
|
||||
$settings['siteUrl'] = rtrim('/', $settings['url']);
|
||||
$settings['siteUrl'] = rtrim($settings['siteUrl'], '/');
|
||||
|
||||
$attachmentTypes = array();
|
||||
if ($this->isEnableByCheckbox($settings['attachmentTypes'], '@image@')) {
|
||||
|
||||
Reference in New Issue
Block a user