turnermm / ckgedit

CKEditor integrated into Dokuwiki
https://www.dokuwiki.org/plugin:ckgedit
GNU General Public License v2.0
60 stars 49 forks source link

ImgPaste support in ckgedit #662

Closed obel1x closed 2 years ago

obel1x commented 2 years ago

The plugin ImgPaste has a very useful setting, letting you define the created filename and namespace for pasted files (e.g. images). Would it be possible to use its setting if existent? Or maybe use its functionallity completely if installed instead of the own functions? Or would it be better to have a new parameter with the same functionality for upping the file?

Would really love to see that feature, while upping the files to the current namespace leads to very unstructured media-collections on my/our sites.

turnermm commented 2 years ago

Do you mean that for each image you can choose a different id? Where do you find this feature? It saves its files to a predefined directory set in the configuration manager. Or is that what you mean?

obel1x commented 2 years ago

Yes - if id = name of the uploaded file. The files that have been pasted with ctrl+v will be saved named like this:

How to name pasted images. You can use the placeholders @USER@, @NS@, @ID@, @PAGE@ and strftime placeholders. The file extension is added automatically.

So e.g. setting it to e.g. @NS@:@PAGE@:%Y%m%d-%H%M%S will make pasted files be saved to the namespace of the page and by date. To find the feature, install it via plugins ImgPaste. After that, the setting can be found in DW config. Using standard "DW Edit", it will work when ctrl+v images, but in ckgedit there is another logic, not using the defined format of ImgPaste.

turnermm commented 2 years ago

I've already looked at it. And it's a simpler system than what I had initially inferred from your original post. Interestingly, it appears to be limited to use in Chrome. Anyway, I can look at using the imgpaste system in wikis that use the imgpaste plugin, no guarantees. If I do, it won't be restricted to Chrome.

turnermm commented 2 years ago

I've added imgpaste support to ckgedit. It is temporarily in the imgpaste branch. So try it out and report back. Thnx.

https://github.com/turnermm/ckgedit/archive/refs/heads/imgpaste.zip

turnermm commented 2 years ago

Now in the master branch but not in current distribution.

obel1x commented 2 years ago

Thank you very much for the fast support and pardon for the late answer , whil me only having time sundays currently. Your work is awsome!

Testing it, basically it works as expected.

There is a small problem i found: When saving the page, now i got: "Warning: Use of undefined constant filename - assumed 'filename' (this will throw an Error in a future version of PHP) in /srv/www/htdocs/dokuwiki/lib/plugins/ckgedit/action/save.php on line 379

Warning: Cannot modify header information - headers already sent by (output started at /srv/www/htdocs/dokuwiki/lib/plugins/ckgedit/action/save.php:379) in /srv/www/htdocs/dokuwiki/inc/common.php on line 1975"

Those warnings are related to a small mistake there, i fixed it in the push #663 above.

I somewhat don't get github - hope the changes are fine like this or may i open a new issue?

turnermm commented 2 years ago

Works fine, and merged. Thank you. For some reason, the error did not show up on my server, possibly different versions of php.