Redactor plugin to create anchors inside the edited text
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
INSTALL
LICENSE
README.md
anchors.js
redactor.js

README.md

anchors_redactor_plugin

Concrete5 / Redactor plugin to create anchors & table of contents (toc) inside the edited text (version 10 of Redactor and tested on Concrete5.7.4RC2).

Please follow the INSTALL to add/register/enable the plugin in C5. Then, a new button having an anchor on it, should appear in Redactor's toolbar.

See images:

Usage/Features:

  • calculates anchor names from the selected text (if any text is selected), in the format of url slugs
  • allows choosing anchor name (if no text is selected)
  • adds anchors at the start of the current paragraph (be it P, H1, H2...)
  • allows auto generating anchors from all H1,H2...H6 tags found in the text. It generates automatically the anchor names.
  • allows generating a very basic table of contents, based on all found anchors.
  • indicates visually where anchors created with this addon (class="anchors") are in text (Thanks to Karl Dilkington for contribution)
  • allows deletion of all anchors created using this addon (class="anchors"), to start anew.

Limitations/Issues:

  • Was not tested in complex HTML, like one that is copy/pasted from Word for example. It was tested only clean HTML. However, Redactor is cleaning any copy/pasted html from Word by default, so we should be safe.
  • Doesn't allow modifying existing anchors in GUI, just blindly adding new ones. For any modification, the HTML view should be used.
  • It adds an empty each time it is used without any pre-selected text. This is probably inoffensive but a bit annoying.
  • there is no automatic registering in Concrete 5.7, it needs altering some files manually.
  • the TOC indentation is really ugly... I have tried with   only, but by default Redactor eliminates multiple &nbsps at saving time, so it was destroyiung the "tree" like structure.