Skip to content

Commit

Permalink
Craft 4 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kringkaste committed May 2, 2022
1 parent 388f280 commit 8cdef2d
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 17 deletions.
14 changes: 12 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
# Redactor nofollow link plugin Changelog

## Unreleased
## 2.0.0 - 2022-05-02

### Added

- Craft CMS 4 compatibility

### Changed
- Fixed background color of icon

- Requires Craft CMS >= 4.0 and Redactor >= 3.0

## 1.0.1 - 2020-04-08

### Fixed
-
- Fixed a bug when editing an existing link with the target="_blank" attribute causing the checkbox "nofollow" to always be selected.

## 1.0.0 - 2019-05-16

### Added
-
- Initial release
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Redactor nofollow link plugin for Craft CMS 3.x
# Redactor nofollow link plugin for Craft CMS

![Icon](resources/nofollow.png)

Expand All @@ -10,8 +10,8 @@ For a lot of sites it is important to set links to ```rel="nofollow"```. Redacto

## Requirements

* Craft CMS >= 3.0.0
* Craft Redactor Plugin >= 2.1.0
* Craft CMS >= 4.0.0
* Craft Redactor Plugin >= 3.0.0

## Installation

Expand All @@ -33,7 +33,7 @@ Add the new plugin to your Redactor config file:
}
```

The ```nofollow``` will be stripped in all Redactor fields by the HTMLPurifier, which is enabled by default. Instead of disabling the hole HTMLPurifier for a field, you should create your own JSON config file in the directory ```config/htmlpurifier``` and add the following content:
The ```nofollow``` will be stripped in all Redactor fields by the HTMLPurifier, which is enabled by default. Instead of disabling the hole HTMLPurifier for a field, you should add the following line to the ```config/htmlpurifier/Default.json```:

```json
{
Expand All @@ -44,6 +44,4 @@ The ```nofollow``` will be stripped in all Redactor fields by the HTMLPurifier,
}
```

The ```"Attr.AllowedRel": ["nofollow"]``` is for this plugin, the first three lines are Craft's default configuration, because your config file overrides Craft's defaults. After creating your config file, you have to activate this in every Redactor field in the advanced section.

With ❤ by [codemonauts](https://codemonauts.com)
11 changes: 4 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "codemonauts/craft-redactor-nofollow",
"description": "Craft CMS plugin to extends the Redactor's link module with the nofollow relationship attribute.",
"version": "1.0.1",
"version": "2.0.0",
"type": "craft-plugin",
"keywords": [
"craft",
Expand All @@ -24,8 +24,8 @@
"issues": "https://github.com/codemonauts/craft-redactor-nofollow/issues"
},
"require": {
"craftcms/cms": "^3.0.0",
"craftcms/redactor": "^2.1.7"
"craftcms/cms": "^4.0.0-alpha.1",
"craftcms/redactor": "^3.0.0-beta.1"
},
"autoload": {
"psr-4": {
Expand All @@ -35,9 +35,6 @@
"extra": {
"handle": "nofollow",
"class": "codemonauts\\nofollow\\Nofollow",
"name": "Redactor nofollow link plugin",
"description": "Extends the Redactor's link module with the nofollow relationship attribute.",
"hasCpSection": false,
"hasSettings": false
"name": "Redactor nofollow link plugin"
}
}
Binary file modified resources/nofollow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/Nofollow.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public function init()

if (Craft::$app->request->isCpRequest) {
// Register Plugin Path
Event::on(Field::class, Field::EVENT_REGISTER_PLUGIN_PATHS, function(RegisterPluginPathsEvent $event) {
$event->paths[] = __DIR__.'/resources/';
Event::on(Field::class, Field::EVENT_REGISTER_PLUGIN_PATHS, function (RegisterPluginPathsEvent $event) {
$event->paths[] = __DIR__ . '/resources/';
});

Field::registerRedactorPlugin('nofollow');
Expand Down
10 changes: 10 additions & 0 deletions src/icon-mask.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8cdef2d

Please sign in to comment.