(Grav GitSync) Automatic Commit from dan

This commit is contained in:
dan 2021-12-12 10:05:01 +13:00 committed by GitSync
parent ead42970a1
commit 0620e68316
7 changed files with 44 additions and 3 deletions

View File

@ -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.

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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'

View File

@ -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()

View File

@ -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