mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 16:33:00 +00:00
Allow the entry of tab characters into the edit page textarea. Fixes #84.
This commit is contained in:
parent
7723c52d7e
commit
c17830883d
4 changed files with 32 additions and 2 deletions
|
@ -3237,6 +3237,11 @@ register_module([
|
||||||
"thing_url" => "https://gist.github.com/jbroadway/2836900",
|
"thing_url" => "https://gist.github.com/jbroadway/2836900",
|
||||||
"icon" => "https://avatars2.githubusercontent.com/u/87886?v=3&s=24"
|
"icon" => "https://avatars2.githubusercontent.com/u/87886?v=3&s=24"
|
||||||
],
|
],
|
||||||
|
"Insert tab characters into textareas" => [
|
||||||
|
"author" => "Unknown",
|
||||||
|
"author_url" => "http://stackoverflow.com/q/6140632/1460422",
|
||||||
|
"thing_url" => "https://jsfiddle.net/2wAzx/13/",
|
||||||
|
],
|
||||||
"Default Favicon" => [
|
"Default Favicon" => [
|
||||||
"author" => "bluefrog23",
|
"author" => "bluefrog23",
|
||||||
"author_url" => "https://openclipart.org/user-detail/bluefrog23/",
|
"author_url" => "https://openclipart.org/user-detail/bluefrog23/",
|
||||||
|
@ -3583,6 +3588,16 @@ register_module([
|
||||||
<input type='text' name='tags' value='$page_tags' placeholder='Enter some tags for the page here. Separate them with commas.' title='Enter some tags for the page here. Separate them with commas.' tabindex='2' />
|
<input type='text' name='tags' value='$page_tags' placeholder='Enter some tags for the page here. Separate them with commas.' title='Enter some tags for the page here. Separate them with commas.' tabindex='2' />
|
||||||
<p class='editing-message'>$settings->editing_message</p>
|
<p class='editing-message'>$settings->editing_message</p>
|
||||||
<input name='submit-edit' type='submit' value='Save Page' tabindex='3' />
|
<input name='submit-edit' type='submit' value='Save Page' tabindex='3' />
|
||||||
|
<script>
|
||||||
|
// Adapted from https://jsfiddle.net/2wAzx/13/
|
||||||
|
document.querySelector(\"[name=content]\").addEventListener(\"keydown\", (event) => {
|
||||||
|
var currentValue = event.target.value, startPos = event.target.selectionStart, endPos = event.target.selectionEnd;
|
||||||
|
event.target.value = currentValue.substring(0, startPos) + \"\\t\" + currentValue.substring(endPos);
|
||||||
|
event.target.selectionStart = event.target.selectionEnd = startPos + 1;
|
||||||
|
event.stopPropagation(); event.preventDefault();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</form>";
|
</form>";
|
||||||
exit(page_renderer::render_main("$title - $settings->sitename", $content));
|
exit(page_renderer::render_main("$title - $settings->sitename", $content));
|
||||||
});
|
});
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
"author": "Starbeamrainbowlabs",
|
"author": "Starbeamrainbowlabs",
|
||||||
"description": "Adds the credits page. You *must* have this module :D",
|
"description": "Adds the credits page. You *must* have this module :D",
|
||||||
"id": "page-credits",
|
"id": "page-credits",
|
||||||
"lastupdate": 1465815023,
|
"lastupdate": 1471548456,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -113,7 +113,7 @@
|
||||||
"author": "Starbeamrainbowlabs",
|
"author": "Starbeamrainbowlabs",
|
||||||
"description": "Allows you to edit pages by adding the edit and save actions. You should probably include this one.",
|
"description": "Allows you to edit pages by adding the edit and save actions. You should probably include this one.",
|
||||||
"id": "page-edit",
|
"id": "page-edit",
|
||||||
"lastupdate": 1471525437,
|
"lastupdate": 1471548511,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
5
modules/page-credits.php
Normal file → Executable file
5
modules/page-credits.php
Normal file → Executable file
|
@ -53,6 +53,11 @@ register_module([
|
||||||
"thing_url" => "https://gist.github.com/jbroadway/2836900",
|
"thing_url" => "https://gist.github.com/jbroadway/2836900",
|
||||||
"icon" => "https://avatars2.githubusercontent.com/u/87886?v=3&s=24"
|
"icon" => "https://avatars2.githubusercontent.com/u/87886?v=3&s=24"
|
||||||
],
|
],
|
||||||
|
"Insert tab characters into textareas" => [
|
||||||
|
"author" => "Unknown",
|
||||||
|
"author_url" => "http://stackoverflow.com/q/6140632/1460422",
|
||||||
|
"thing_url" => "https://jsfiddle.net/2wAzx/13/",
|
||||||
|
],
|
||||||
"Default Favicon" => [
|
"Default Favicon" => [
|
||||||
"author" => "bluefrog23",
|
"author" => "bluefrog23",
|
||||||
"author_url" => "https://openclipart.org/user-detail/bluefrog23/",
|
"author_url" => "https://openclipart.org/user-detail/bluefrog23/",
|
||||||
|
|
|
@ -87,6 +87,16 @@ register_module([
|
||||||
<input type='text' name='tags' value='$page_tags' placeholder='Enter some tags for the page here. Separate them with commas.' title='Enter some tags for the page here. Separate them with commas.' tabindex='2' />
|
<input type='text' name='tags' value='$page_tags' placeholder='Enter some tags for the page here. Separate them with commas.' title='Enter some tags for the page here. Separate them with commas.' tabindex='2' />
|
||||||
<p class='editing-message'>$settings->editing_message</p>
|
<p class='editing-message'>$settings->editing_message</p>
|
||||||
<input name='submit-edit' type='submit' value='Save Page' tabindex='3' />
|
<input name='submit-edit' type='submit' value='Save Page' tabindex='3' />
|
||||||
|
<script>
|
||||||
|
// Adapted from https://jsfiddle.net/2wAzx/13/
|
||||||
|
document.querySelector(\"[name=content]\").addEventListener(\"keydown\", (event) => {
|
||||||
|
var currentValue = event.target.value, startPos = event.target.selectionStart, endPos = event.target.selectionEnd;
|
||||||
|
event.target.value = currentValue.substring(0, startPos) + \"\\t\" + currentValue.substring(endPos);
|
||||||
|
event.target.selectionStart = event.target.selectionEnd = startPos + 1;
|
||||||
|
event.stopPropagation(); event.preventDefault();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</form>";
|
</form>";
|
||||||
exit(page_renderer::render_main("$title - $settings->sitename", $content));
|
exit(page_renderer::render_main("$title - $settings->sitename", $content));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue