diff --git a/pages/01.blog/aura-authors-plugin/item.en.md b/pages/01.blog/aura-authors-plugin/item.en.md new file mode 100644 index 0000000..a8a16aa --- /dev/null +++ b/pages/01.blog/aura-authors-plugin/item.en.md @@ -0,0 +1,9 @@ +--- +title: 'Aura Authors Plugin' +published: false +aura: + author: dan +--- + +We've changed the [original-plugin](https://github.com/matt-j-m/grav-plugin-aura-authors) a little to our needs. It's a quick solution but easy to change if you need to. So if you're using GRAV as your Blog or News feed and looking for an author plugin for multilingual as well so that you can have multi-authors for multilingual you can have a look at [github.com/TECH-SAVIOURS-ORG](https://github.com/TECH-SAVIOURS-ORG/grav-plugin-aura-authors). +The code is hardcode atm we might change it in the future if we need to. diff --git a/plugins/page-toc/CHANGELOG.md b/plugins/page-toc/CHANGELOG.md index 18866d2..0bd7de7 100644 --- a/plugins/page-toc/CHANGELOG.md +++ b/plugins/page-toc/CHANGELOG.md @@ -1,8 +1,14 @@ +# v3.1.0 +## 12/09/2021 + +1. [](#new) + * **NEW** Added option to automatically copying to clipboard an anchor URL when clicking on it + # v3.0.0 ## 12/03/2021 1. [](#new) - * **NEW** Support built-in `anchors`'` with customization of icon/classes/css etc. + * **NEW** Support built-in `anchors` with customization of icon/classes/css etc. * **NEW** `[anchor]` shortcode for creating manual anchors for easy linking to page content * Moved the vendor-based TOC functionality in-plugin to provide more flexibility and additional features * Added several more Twig functions for increased flexibility diff --git a/plugins/page-toc/assets/page-toc-anchors.js b/plugins/page-toc/assets/page-toc-anchors.js new file mode 100644 index 0000000..ec5c459 --- /dev/null +++ b/plugins/page-toc/assets/page-toc-anchors.js @@ -0,0 +1,10 @@ +document.body.addEventListener('click', (event) => { + if (typeof event.target.dataset.anchorIcon !== 'undefined') { + const href = event.target.href; + navigator.clipboard.writeText(href) + .then(() => {}) + .catch((error) => { + console.error('Unable to copy to clipboard the anchor', error); + }); + } +}, true); \ No newline at end of file diff --git a/plugins/page-toc/blueprints.yaml b/plugins/page-toc/blueprints.yaml index ba2e5af..e43536d 100644 --- a/plugins/page-toc/blueprints.yaml +++ b/plugins/page-toc/blueprints.yaml @@ -1,7 +1,7 @@ name: Page Toc type: plugin slug: page-toc -version: 3.0.0 +version: 3.1.0 description: Generate a table of contents and anchors from a page icon: list author: @@ -143,6 +143,17 @@ form: options: before: PLUGIN_PAGE_TOC.BEFORE_TEXT after: PLUGIN_PAGE_TOC.AFTER_TEXT + anchors.copy_to_clipboard: + type: toggle + label: PLUGIN_PAGE_TOC.COPY_TO_CLIPBOARD + help: PLUGIN_PAGE_TOC.COPY_TO_CLIPBOARD_HELP + highlight: 1 + default: 1 + options: + 1: Enabled + 0: Disabled + validate: + type: bool anchors.slug_maxlen: type: number label: PLUGIN_PAGE_TOC.SLUG_MAXLEN diff --git a/plugins/page-toc/languages.yaml b/plugins/page-toc/languages.yaml index e36125d..60b8a85 100644 --- a/plugins/page-toc/languages.yaml +++ b/plugins/page-toc/languages.yaml @@ -23,6 +23,8 @@ en: ANCHORS_ICON_HELP: 'Can be any text character, symbol, unicode character or even emjoi. leave blank if you intend to style with CSS.' ANCHORS_POSITION: 'Anchor Position' ANCHORS_POSITION_HELP: 'Position to put the anchor, `before|after`' + ANCHORS_COPY_TO_CLIPBOARD: 'Copy to Clipboard' + ANCHORS_COPY_TO_CLIPBOARD_HELP: 'When clicking an anchor, it will also copy to clipboard the full URL. Convenient for sharing/opening in new tab' BEFORE_TEXT: 'Before text' AFTER_TEXT: 'After text' SLUG_MAXLEN: 'Slug max-length' diff --git a/plugins/page-toc/page-toc.php b/plugins/page-toc/page-toc.php index 74c2d1b..a59498f 100644 --- a/plugins/page-toc/page-toc.php +++ b/plugins/page-toc/page-toc.php @@ -116,6 +116,9 @@ class PageTOCPlugin extends Plugin if ($this->grav['config']->get('plugins.page-toc.include_css')) { $this->grav['assets']->addCss('plugin://page-toc/assets/page-toc-anchors.css'); } + if ($this->grav['config']->get('plugins.page-toc.anchors.copy_to_clipboard')) { + $this->grav['assets']->addJs('plugin://page-toc/assets/page-toc-anchors.js', ['group' => 'bottom', 'defer' => 'defer']); + } } public function registerTwigFunctions() diff --git a/plugins/page-toc/page-toc.yaml b/plugins/page-toc/page-toc.yaml index ad9ed0b..da89e23 100644 --- a/plugins/page-toc/page-toc.yaml +++ b/plugins/page-toc/page-toc.yaml @@ -12,6 +12,6 @@ anchors: # Anchor configuration class: # Custom Header anchor styling classes icon: '#' # Icon to use, can be a symbol, emoji, ascii etc. position: after # Position to put the anchor, `before|after` - copy_to_clipboard: true # Copy to clipboard functionality (coming soon) + copy_to_clipboard: false # Copy to clipboard functionality slug_maxlen: 25 # Max length of slugs used for anchors slug_prefix: # A prefix used in front of generated slugs