getgrav / getgrav/grav-plugin-admin

Feature: configure the editor related to pagemedia field.

Open
#2,362 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
377
Forks
225
Avg merge
11h 51m
Merged PRs (30d)
4

Description

Currently the button `+` of the field / plugin `pagemedia` only works with an editor if it's named `content` (as in the `default` template).

The purpose of this button is to insert an image or file into the editor as a markdown link.

On the other hand, the drag & drop option works always.

This is because the editor name is hardcoded in the plugin code at `themes/grav/app/pages/page/media.js`, line `155`:

```javascript
let editor = Editor.editors.filter((index, editor) => $(editor).attr('name') === 'data[content]');
```
So as I understand there is no option to instruct the field / plugin to select another editor.

It could be very difficult to implement?

I will appreciate any help on this.

Thanks.

Contributor guide

Open the contributing guide

Research direction

Start by reading themes/grav/app/pages/page/media.js around line 155, where the pagemedia button selects the editor named data[content]. Compare that behavior with the drag-and-drop path and determine how the field or plugin could identify another editor. Done means the button can target a configured editor and still inserts an image or file as a markdown link.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, markdown
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.