Hi,

Is there plans to introduce D8 version of this module?

We would like to help you with development of this version or to implement it from scratch.

Thanks,
Danu

CommentFileSizeAuthor
#16 insert.png32.38 KBkferencz91
#16 error.png63.96 KBkferencz91
Members fund testing for the Drupal project. Drupal Association Learn more

Comments

andypost’s picture

any plans to port the module? or it should be replaced by media?

GiorgosK’s picture

partly this module can help with some use cases
https://www.drupal.org/project/editor_file

GrahamShepherd’s picture

At the moment (March 2016) there are over 78,000 users of the Insert module. Upgrading to D8 would appear to be a matter of some urgency. Or to provide an upgrade path to something similar like Editor_file, although, as GiorgosK points out, this only covers some use cases.

timoti’s picture

I'm utterly confounded as to what people are using for d8, without the wonderful insert module, and why there would not be more impetus, support, bounties or just general clamour to drupal8ize Insert.

Can anyone enlighten on this please?

rjjakes’s picture

FYI - I'm currently working on a D8 version of this module. I'll upload a patch as soon as I have something usable.

rv0’s picture

just posting this here, seems like that's the way to go https://www.drupal.org/project/embed

Snater’s picture

Hi. The Insert module is just awesome in its user interface simplicity. Hence, it became a prerequisite for each of my Drupal applications as I do not want to annoy content administrators with crude usability. I spent about a week trying to craft the module for Drupal 8 by myself and uploaded the code to https://github.com/Snater/insert. With just a first glance at Drupal 8, it has not been an easy task to rewrite the mechanics and the module is not thoroughly tested yet; But it seems to work quite smoothly on my system so far and I would not have uploaded the code if I was not confident about being able to fix any stability issues.

axel.rutz’s picture

@Snater: Sounds great! So we have an 8.x version candidate!

kferencz91’s picture

@Snater: AWESOME job with this port. I have encountered a lot of bugs with the image insert that's in Drupal 8 core at this point, so this is a welcome alternative.

Snater’s picture

Hi. I am still working on the module and I will very likely use it in production starting at some point in the next few weeks. It might be best for the code to be on drupal.org. However, I am not a long-time member of drupal.org and what I read about the approval process and what other circumstances might be that I did not read about made me shy away from pursuing that for now. I need the module to work with the features I require right now. If I was assured of being able to upload and manage the code at will just as on GitHub, I might consider moving the code to drupal.org instantly. Else, starting that process needs to wait a few weeks. Anyway, I am very interested in getting the code on drupal.org in the long run as that would be the basis for making the module more robust.
Apart from that, I am not perfectly sure if there is not another approach to implementing the module in the form of widget plug-ins. For example, I would like to have the module interact with some image cropping module. But that might be very hard to resolve.
Please note: Since I am not a confirmed user, I cannot send personal messages at the moment.

quicksketch’s picture

Status: Active » Needs review

Hi @Snater, I was contacted by @kslagboom pointing to this issue. It looks like you've done a fine job with the port. Although you do have to go through the contrib approval process to create new modules, you can easily be added as a co-maintainer to an existing project such as this one.

I gave the initial port a review and it is quite honestly better than I could do with D8, as I've jumped over to Backdrop. I've added you as a maintainer and you can now commit to the repository as well as update the project page. It also looks like you've been marked a confirmed user now, so if you have any more questions send me a message.

bill_redman’s picture

Hi @Snater, thanks for doing this D8 port. I am one of the many users who use the Insert module in multiple websites and was surprised that nothing had been done before now. Anyway, I installed it on one of my D8 sites and all went as you described until I actually tried to insert an image on a page. It failed with the following error:

Uncaught TypeError: Cannot read property 'replace' of undefined
at String. (FileInserter.js:197)
at Function.each (jquery.min.js:2)
at ImageInserter._replacePlaceholders (FileInserter.js:194)
at ImageInserter._replacePlaceholders (ImageInserter.js:126)
at ImageInserter._buildContent (FileInserter.js:172)
at HTMLInputElement. (FileInserter.js:54)
at HTMLInputElement.dispatch (jquery.min.js:3)
at HTMLInputElement.r.handle (jquery.min.js:3)

Now I know you clearly indicated that this was a work in progress, but I was wondering if you would have any thoughts as to the cause of this error. If this is not the correct place for posing this question, my apologies.

deminy’s picture

@Snater, thanks for the efforts having a D8 version there. From what I've tested, I feel that it would be even better if we could provide some hook functions just like in Drupal 7.

In Drupal 7 there is a hook function hook_insert_styles(), which is used in Drupal 7 module Colorbox (function colorbox_insert_styles()). Function colorbox_insert_styles() provides some more image styles on field managing pages like http://example.com/admin/structure/types/manage/blog/fields/field_image . In Drupal 8, there is no options to select image styles for module insert on pages like http://example.com/admin/structure/types/manage/article/fields/node.arti... .

Again, thanks for the efforts.

Snater’s picture

Hi. Please excuse my absence, I sort of forgot about having posted here while working on other stuff. I am quite satisfied with how the module works at the moment with my configuration and I will have it run in production soon. However, I am pretty sure there are bugs regarding other configurations.

Thank you for adding me as a co-maintainer, @quicksketch. I will look into that and try to move the code to drupal.org. (And thank you for the initial module for Drupal 7, major factor I got started with Drupal.)

@Bill Redman: It seems the template to insert the image with cannot be retrieved from the DOM. I tried different scenarios, but it works for me. I will at least add some sensible debug output for that case to allow figuring out what might cause the error.
(I would like to write some tests, but did not have the time to look into the testing framework yet.)

@deminy: Excuse me, if I do not understand the problem correctly. Indeed, my initial idea was to integrate the Insert module settings, just like in the Drupal 7 version, into the field configuration (i.e. [...]/node.article.field_image). This, however, as to what I figured out, would have required implementing a new field type since, in Drupal 8, as per design, no sufficient hooks are available to extend the existing image type. An alternative, module-specific image type would be pointless and, in fact, it makes more sense to have the Insert module functionality implemented in the form of a field type widget. Hence, the configuration is done on the form display page (i.e. /admin/structure/types/manage/article/form-display). For an image field, you can select the Image Insert widget and select the image styles you want to allow images to be inserted with in the options.

(A downside of having a widget is that the functionality does not integrate with other widgets; I did not examine possible solutions intensively yet. I would, for example, like to have the Insert module interact with some image cropping module.)

Snater’s picture

Status: Needs review » Fixed

Moved the code from GitHub to drupal.org and created a development release: https://www.drupal.org/project/insert/releases/8.x-1.x-dev. Feel free to create issues for individual bugs. I will not work on the project every day, but I will try to get the module version solid enough for others to use it properly.

kferencz91’s picture

FileSize
63.96 KB
32.38 KB

I am also running into the same issue Bill Redman mentions in #12. I am trying to insert a file inline, and get the following error in the Chrome console:

Uncaught TypeError: Cannot read property 'replace' of undefined
at String. (FileInserter.js:197)
at Function.each (jquery.min.js:2)
at ImageInserter._replacePlaceholders (FileInserter.js:194)
at ImageInserter._replacePlaceholders (ImageInserter.js:126)
at ImageInserter._buildContent (FileInserter.js:172)
at HTMLInputElement. (FileInserter.js:54)
at HTMLInputElement.dispatch (jquery.min.js:3)
at HTMLInputElement.r.handle (jquery.min.js:3)

Running on Drupal 8.2.4. This occurs when clicking the "insert" button to put the file into the body area.

Tytest’s picture

Your hard work is appreciated. Would love to see this in Core someday, a crucial component in my opinion. Following this thread in hopes of Stable D8 version.

Status: Fixed » Closed (fixed)

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