Today I found out about the existence of this module via #2855521-7: Drupalimage calling drupallink functions without checking if the plugin is loaded. Thanks for this valuable contribution! :)

Unfortunately, I noticed this module violates two important guidelines:

  1. Drupal.org does not allow committing 3rd party JS libraries to git.drupal.org. See https://www.drupal.org/project/drupalorg_whitelist. Several CKEditor plugins are already whitelisted: https://www.drupal.org/packaging-whitelist?title=ckeditor.
  2. Drupal 8 uses an alternative implementation of the link plugin. It was developed in collaboration with the CKEditor team. The Drupal implementation allows to use hook_form_alter() and removes all the edge case link dialog options.

(I'm the maintainer of the ckeditor.module component in Drupal 8.)

This module is valuable and fills a niche that's very important to a small set of people (<5% of users). But it's doing so by importing CKEditor plugins that conflict with Drupal core's plugins. So unfortunately, to properly integrate, this should stop copy/pasting CKEditor's official anchor link plugin (which would also prevent issues like #2885447: Upgraded plugin versions breaks edit functionality from ever happening again), and instead write its own CKEditor plugin, so that it can be used together with \Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalLink and https://www.drupal.org/project/editor_advanced_link.

See #2595337: Add "Anchor" button.

Comments

Wim Leers created an issue. See original summary.

Rajab Natshah’s picture

Thank you, Wim for your time :)

I LOVE Open Source!!
We keep sharing and learning from the best of us, all the time.

I will follow on steps, to correct all notes and remarks.

We needed the Anchor only "The button with a flag icon" in CKEditor under Drupal 8.
I wish that we have this Anchor button in Drupal 8 core.

Anchor linking is very important for many websites.
bible.org for example: Having the anchor button was a decision switcher to update from Drupal 7 to Drupal 8, Do you think they will go with that at this time?
If anchor button was already in Drupal Core CKEditor, they could be had went with the decision just like that.

I find out that only the following CKEditor plugin do have anchor flag button.
http://ckeditor.com/addon/link
link and anchor
Did not need the link tho.

Following on the steps:
1. Drupal.org Library Packaging White list Issues CKEditor Anchor link

Added https://www.drupal.org/node/2888309

I did this before for CKEditor - BiDi (Text Direction)
But we needed to have it in the .make file for custom profiles.

2. Developers could use the anchor and keep the drupal core link or use other linking like linkit.

a. #2832883: Default CKEditor command for double click on critical HTML Tags to edit in CKEditor
b. #2802085: Duplicate edit link menu items in CKEditor
c. Yesterday I had a look at this new module ( Restricted links filter ), I think we could do a custom module to have the default double click/right click/key press action filter to select which command to run or which right click menu link item to show

Any help is welcome.

Rewarded and enjoyable time working on this project :)

Rajab Natshah’s picture

instead write its own CKEditor plugin

I'm with a custom Anchor button in Drupal core. just like the core link.
Personally I will switch to us it :)

Wim Leers’s picture

I wish that we have this Anchor button in Drupal 8 core.

I understand! But that's where your wonderful module comes in :)

Developers could use the anchor and keep the drupal core link or use other linking like linkit.

No, they can't. Because the "Anchor" functionality in CKEditor (and in this module) is provided by the CKEditor core link plugin. Drupal core intentionally does not ship with this, as I explained. When this module is installed, things break, as is shown in #2855521: Drupalimage calling drupallink functions without checking if the plugin is loaded, #2848535: Unable to create link when wrapping img, #2802085: Duplicate edit link menu items in CKEditor and #2885447: Upgraded plugin versions breaks edit functionality (and there's probably more).

Rewarded and enjoyable time working on this project :)

Glad to hear that! :)

I'm with a custom Anchor button in Drupal core. just like the core link.
Personally I will switch to us it :)

Woot! Let me know if you're stuck on something!

dsnopek’s picture

What is the status of this issue?

I just posted #2939895: Changed to depend on fakeobjects module which is sort of tangentially related to this...

If the CKEditor plugin code was removed from this module, a dependency on the 'fakeobjects' module was added, and then a super simple plugin for creating anchors was added, that would basically satisfy this issue!

Is that on the table? I might be willing to work on such a thing because I need to get anchor functionality into panopoly_wysiwyg somehow.

dsnopek’s picture

I started an implementation of a CKEditor "anchor" plugin from scratch on this panopoly_wysiwyg issue:

#2939911: Anchor support in Drupal 8

It doesn't do much yet, but it's a start! :-)

I don't know how to make the dialog and form be more Drupal-y (ie. be a Drupal form), but I'm not sure that's even necessary here - what would anyone want to alter into an anchor form? The single text field might be sufficient.

dsnopek’s picture

Rajab Natshah’s picture

Totally agree with you David!
CKEditor FakeObjects
I wish that FakeObjects and the Anchor Link comes with Drupal 8 Core CKEditor package.

Drupal.org Library Packaging Whitelist

#2940014: CKEditor Fake Objects

I had created the following issue 7 months ago

#2888309: CKEditor Anchor link

chipway’s picture

I vote for anchor link in Core as proposed by Wim.

dsnopek’s picture

We just implemented a custom anchor plugin in panopoly_wysiwyg! It doesn't use a Drupal form yet, but once that's implemented, we'd like to spin that functionality back out into a new module. See:

Would moving that functionality into this module (as a replacement for what's currently here) be an option?

rootwork’s picture

@dsnopek Given the lack of movement (in terms of code) on this issue, I think moving the functionality into this module would be great.

If you do decide to release your own module, please let us know in this issue!

Rajab Natshah’s picture

Starting a new branch 8.x-2.x to follow with the best practice and have the
#2939895: Changed to depend on fakeobjects module

Rajab Natshah’s picture

Version: 8.x-1.x-dev » 8.x-2.x-dev
Rajab Natshah’s picture

  • RajabNatshah committed 76225df on 8.x-2.x
    Issue #2888087 by RajabNatshah, dsnopek, Wim Leers, rootwork, chipway:...
Rajab Natshah’s picture

Status: Active » Needs review

Required Anchor link library to follow with d.o guidelines and D8 guidelines — and stoped copy/pasting CKEditor plugin and allow developers to roll their own

Rajab Natshah’s picture

Hi @Wim,

Let me know if you're stuck on something!

What are other steps to go with to have the module in Drupal Core or a custom CKEditor anchor management plugin
and a kind of CKEditor fakeobjects plugin.

Only Anchor link button with fakeobjects

Not sure where to move with ideas from this point.
Released Anchor Link 8.x-2.0-alpha1

Rajab Natshah’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

alison’s picture

Hi! Just double-triple-checking -- is this module now in line with guidelines? Thank you!