diff --git a/Asset/Javascript/main.js b/Asset/Javascript/main.js new file mode 100644 index 0000000..92fb0e6 --- /dev/null +++ b/Asset/Javascript/main.js @@ -0,0 +1,16 @@ + +KB.on('dom.ready', function () { + function goToLink(selector) { + if (!KB.modal.isOpen()) { + let element = KB.find(selector); + + if (element !== null) { + window.location = element.attr('href'); + } + } + } + + KB.onKey('v+w', function () { + goToLink('a.view-wiki'); + }); +}); diff --git a/Asset/Javascript/wiki.js b/Asset/Javascript/wiki.js index 22d22d0..c27df43 100644 --- a/Asset/Javascript/wiki.js +++ b/Asset/Javascript/wiki.js @@ -20,7 +20,7 @@ jQuery(document).ready(function () { } // console.log("request", request) - + $.ajax({ cache: false, @@ -49,20 +49,3 @@ jQuery(document).ready(function () { }) } }); - -KB.on('dom.ready', function () { - function goToLink(selector) { - if (!KB.modal.isOpen()) { - let element = KB.find(selector); - - if (element !== null) { - window.location = element.attr('href'); - } - } - } - - KB.onKey('v+w', function () { - goToLink('a.view-wiki'); - }); -}); - diff --git a/Plugin.php b/Plugin.php index e3cdd97..2c680f7 100755 --- a/Plugin.php +++ b/Plugin.php @@ -43,14 +43,15 @@ public function initialize() $this->template->hook->attach('template:header:dropdown', 'wiki:header/dropdown'); $this->template->hook->attach('template:project-header:view-switcher', 'Wiki:project_header/views'); - + $this->template->setTemplateOverride('board/view_public', 'wiki:board/view_public'); - + $this->template->setTemplateOverride('file_viewer/show', 'wiki:file_viewer/show'); $this->hook->on('template:layout:css', array('template' => 'plugins/Wiki/Asset/css/wiki.css')); // $this->hook->on('template:layout:js', array('template' => 'plugins/Wiki/Asset/vendor/jquery-sortable/jquery-sortable.js')); // $this->hook->on('template:layout:js', array('template' => 'plugins/Wiki/Asset/Javascript/wiki.js')); + $this->hook->on('template:layout:js', array('template' => 'plugins/Wiki/Asset/Javascript/main.js')); // $this->template->setTemplateOverride('wiki', 'wiki:wiki/layout'); @@ -59,7 +60,7 @@ public function initialize() // $this->helper->register('wiki', '\Kanboard\Plugin\Wiki\Helper\layout'); $this->helper->register('wikiHelper', '\Kanboard\Plugin\Wiki\Helper\WikiHelper'); - + }