mikitex70 / redmine_drawio

Macro plugin to embed draw.io diagrams into Redmine wiki pages
MIT License
123 stars 51 forks source link

EasyRedmine: Add button to CKEditor to add diagram #21

Open amenk opened 7 years ago

amenk commented 7 years ago

Will try this

amenk commented 7 years ago

Is there a ckeditor in standard redmine? Awesome you want to implement it.. I failed setting up the environment

mikitex70 commented 7 years ago

Yes, there is a public available CKEditor plugin. I've already installed it, I'm trying to let accept my extension: CKEditor expects extensions come from a specific folder, and this isn't the case. But I'm almost sure to be able to implement it.

amenk commented 7 years ago

How do you plan to do it? Just adding the makro-code via button click or will the editor also directly open and let them draw the diagram?

amenk commented 7 years ago

Works like a charm. I think directly editing in-pace is too complicated ... leave it.. When do you plan to make a release?

mikitex70 commented 7 years ago

I'm working on creating a widget for the CKEditor, I'm trying to save the edited diagram. I'm not sure to be able to get it working but I will try some more time. Maybe I will release the new version this evening or tomorrow evening.

amenk commented 7 years ago

ok, good luck.

amenk commented 7 years ago

Could the width-in-pixels (I think it is kind of auto sizing anyways?) and picture format be pre-configured, for example in the plugin settings and maybe hide-able? Less is easier for the user ...

mikitex70 commented 7 years ago

If the width is empty the image will be autosized, and at its maximum size it will fill the page width. The size option is necessary when diagram is big and needs to be restricted to only a portion of the page. It was a user request.

amenk commented 7 years ago

Are you still working on the inline editing? Otherwise it work's well and the issue can be closed ...

mikitex70 commented 7 years ago

No, the inline editing is momentarily suspended, it needs a lot of tuning so I'm planning to release it in the future. Now I'm working on fixing bugs and testing.

carukc commented 6 years ago

Hi Mikitex,

Did you ever get back to this? We are using EasyRedmine as well and this seems like a great enhancement.

Thanks Chris

mikitex70 commented 6 years ago

I'm working on it, but I'm busy with my work so I don't have much time to devote to this development. At this time the buttons are working, I'm trying to allow inline editing without the need to use Redmine macros and to save the document. I think I'll have during Christmas holidays, maybe I can release something in January. I need to get it working together with my redmine_reveal plugin in EasyRedmine (the problem is CKEditor). For the two plugins the only problem now is the inline editing, some parts are working, others not.

carukc commented 6 years ago

Hi... Thanks for the reply. Yes... gave it a try and discovered that the buttons were in. Inline editing would also be cool. it's a bit of a hassle to have to save then edit. I think that I'm going to take stab at adding a couple more options. It would be really nice if you could do something like float=right or float=left to get the text to wrap around the image. border=x would be interesting to add styling for a gutter around the image. Time permitting I also hope to get the Atlas template looking more like the ER template so that the header loos the same when you activate the editor. I'll let you know how we get on just in case you want to add these changes to your code.

I did not realize that redmine_reveal was yours too. I saw that too and wanted to give it a try. It also looks very interesting. Yes... it would be great if they worked together. I'm a little worried though about the two plugins adding a lot of weight to an already very full compliment of JS in ER pages.

Thanks again for the estimates!

Chris

amenk commented 5 years ago

I was working in the meantime, now it isn't anymore. Just wanted to say that :-) Is this being worked on?

mikitex70 commented 5 years ago

I have a semi-working version... but I don't have much time to continue development. Next weekend I will push my work on a separate branch so you can view/test/experiment on it. Or maybe someone else can help in development...

amenk commented 1 year ago

I updated to the recent version of the plugin, using EasyRedmine 10 (actually outdated, so if EasyRedmine v11 would work here, we might as well upgrade).

We never had that button in CKEditor, so I had a look at it again today.

I looks like window.CKEDITOR is not available at the time the drawIoEditor.js is executed. They seem to load CKEDITOR at many places dynamically...

So I patched the file as follows:

var initCkeditor = function() {
    if(typeof CKEDITOR === 'undefined') return false;

    [.. the old $ ready function, unchanged ..]

   }
};

var waitCKEDITOR = setInterval(function () {
    if (window.CKEDITOR) {
        clearInterval(waitCKEDITOR);

        CKEDITOR.on('instanceReady', function (event) {
            initCkeditor();
        });

    }
}, 100);

This makes the button appear (and it works), but without icon. Also some other icons from EasyRedmine are lost. I am getting warnings, that https://<our domain>/easy_extensions/assets/easy_fonts/materialdesignicons-webfont.ttf are not found.

image

@mikitex70 From #67 it looks like this actually should be fixed already? Or is there some branch still to try? Happy to help debugging and testing.

amenk commented 1 year ago

Hm, it looks like in recent versions they have a functionality very similar to this plugin, I am wondering if it shares any code :-)

https://www.easyredmine.com/documentation-of-easy-redmine/article/diagrams

mikitex70 commented 1 year ago

It is likely that they use code made from my work, after all my code has an MIT license. I also noticed that they have other plugins that seems derived from opensource works, for example their DMS appeared after the DMSF plugin and initially the layout was similar.

I'll take a look at my old branch, I don't remember how far I was at. It may be that I can improve it and make it usable, but I do not guarantee, I do not have much time to devote to it. I'll let you know.