mirror of
https://github.com/Codiad/Codiad.git
synced 2026-03-24 18:06:50 +01:00
Merge pull request #143 from maitai/master
Configurable trigger for opening the right sidebar (hover/click)
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,3 +4,4 @@
|
||||
config.php
|
||||
data/
|
||||
workspace/
|
||||
.project
|
||||
|
||||
@@ -164,6 +164,19 @@ switch($_GET['action']){
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
<td><?php i18n("Right Sidebar Trigger"); ?></td>
|
||||
<td>
|
||||
|
||||
<select class="setting" data-setting="right-sidebar-trigger">
|
||||
<option value="false"><?php i18n("Hover"); ?></option>
|
||||
<option value="true"><?php i18n("Click"); ?></option>
|
||||
</select>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -206,6 +219,9 @@ var editor_settings = {
|
||||
case 'wrap-mode':
|
||||
$(this).children('option[value="'+codiad.editor.settings.wrapMode+'"]').prop('selected',true);
|
||||
break;
|
||||
case 'right-sidebar-trigger':
|
||||
$(this).children('option[value="'+codiad.editor.settings.rightSidebarTrigger+'"]').prop('selected',true);
|
||||
break;
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -241,6 +257,10 @@ var editor_settings = {
|
||||
var bool_val = (val == "true");
|
||||
codiad.editor.setWrapMode(bool_val);
|
||||
break;
|
||||
case 'right-sidebar-trigger':
|
||||
var bool_val = (val == "true");
|
||||
codiad.editor.setRightSidebarTrigger(bool_val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -324,7 +324,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$.each(['printMargin', 'highlightLine', 'indentGuides', 'wrapMode'],
|
||||
$.each(['printMargin', 'highlightLine', 'indentGuides', 'wrapMode', 'rightSidebarTrigger'],
|
||||
function(idx, key) {
|
||||
var localValue =
|
||||
localStorage.getItem('codiad.editor.' + key);
|
||||
@@ -937,6 +937,22 @@
|
||||
localStorage.setItem('codiad.editor.wrapMode', w);
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Set trigger for opening the right sidebar
|
||||
//
|
||||
// Parameters:
|
||||
// t - {Boolean} (false for Hover, true for Click)
|
||||
// i - {Editor} (If omitted, Defaults to all editors)
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
setRightSidebarTrigger: function(t, i) {
|
||||
this.settings.rightSidebarTrigger = t;
|
||||
// LocalStorage
|
||||
localStorage.setItem('codiad.editor.rightSidebarTrigger', t);
|
||||
},
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Get content from editor
|
||||
|
||||
@@ -87,22 +87,43 @@
|
||||
|
||||
// Right Column Slider
|
||||
$("#sb-right")
|
||||
.hoverIntent(function() {
|
||||
var timeout_r = $(this)
|
||||
.data("timeout_r");
|
||||
if (timeout_r) {
|
||||
clearTimeout(timeout_r);
|
||||
.click(function() {
|
||||
if (codiad.editor.settings.rightSidebarTrigger) { // if trigger set to Click
|
||||
var timeout_r = $(this)
|
||||
.data("timeout_r");
|
||||
if (timeout_r) {
|
||||
clearTimeout(timeout_r);
|
||||
}
|
||||
$('#editor-region')
|
||||
.animate({
|
||||
'margin-right': '200px'
|
||||
}, 300, 'easeOutQuart', function(){
|
||||
_this.isRigthSidebarOpen = true;
|
||||
});
|
||||
$(this)
|
||||
.animate({
|
||||
'right': '0px'
|
||||
}, 300, 'easeOutQuart');
|
||||
}
|
||||
})
|
||||
.hoverIntent(function() {
|
||||
if (!codiad.editor.settings.rightSidebarTrigger) { // if trigger set to Hover
|
||||
var timeout_r = $(this)
|
||||
.data("timeout_r");
|
||||
if (timeout_r) {
|
||||
clearTimeout(timeout_r);
|
||||
}
|
||||
$('#editor-region')
|
||||
.animate({
|
||||
'margin-right': '200px'
|
||||
}, 300, 'easeOutQuart', function(){
|
||||
_this.isRigthSidebarOpen = true;
|
||||
});
|
||||
$(this)
|
||||
.animate({
|
||||
'right': '0px'
|
||||
}, 300, 'easeOutQuart');
|
||||
}
|
||||
$('#editor-region')
|
||||
.animate({
|
||||
'margin-right': '200px'
|
||||
}, 300, 'easeOutQuart', function(){
|
||||
_this.isRigthSidebarOpen = true;
|
||||
});
|
||||
$(this)
|
||||
.animate({
|
||||
'right': '0px'
|
||||
}, 300, 'easeOutQuart');
|
||||
}, function() {
|
||||
$(this)
|
||||
.data("timeout_r", setTimeout($.proxy(function() {
|
||||
|
||||
@@ -22,6 +22,9 @@ $lang = array(
|
||||
"Wrap Lines" => "Wrap Lines",
|
||||
"No wrap" => "No wrap",
|
||||
"Wrap Lines" => "Wrap Lines",
|
||||
"Right Sidebar Trigger" => "Right Sidebar Trigger",
|
||||
"Hover" => "Hover",
|
||||
"Click" => "Click",
|
||||
"Close" => "Close",
|
||||
"Yes" => "Yes",
|
||||
"No" => "No",
|
||||
|
||||
Reference in New Issue
Block a user