riktar / jkanban

Vanilla Javascript plugin for manage kanban boards
https://www.riccardotartaglia.it/jkanban/
Apache License 2.0
1.06k stars 296 forks source link

HTML Content ? #166

Open TheCodemasterZz opened 2 years ago

TheCodemasterZz commented 2 years ago

itemAddOptions: { enabled: true, content: '<span class="menu-icon"><span class="svg-icon svg-icon-3"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><path opacity="0.3" d="M21 22H14C13.4 22 13 21.6 13 21V3C13 2.4 13.4 2 14 2H21C21.6 2 22 2.4 22 3V21C22 21.6 21.6 22 21 22Z" fill="currentColor"/><path d="M10 22H3C2.4 22 2 21.6 2 21V3C2 2.4 2.4 2 3 2H10C10.6 2 11 2.4 11 3V21C11 21.6 10.6 22 10 22Z" fill="currentColor"/></svg></span></span>', class: 'kanban-title-button btn btn-default btn-xs', footer: false },

is it possible to add html content in itemAddOptions ?

Scantech-Val commented 7 months ago

By looking at the source code, the problem is that a document.createTextNode is used for the button content, which displays your html like text. I had a similar problem, the only thing that worked for me was a quick dirty fix --> by modifying the source code to put by default what i wanted in jkanban.js. At line 346 it put:

if (addButton) {
          var btn = document.createElement('BUTTON')
          var t = document.createTextNode(buttonContent ? buttonContent : '')
          if(!buttonContent){
            btn.innerHTML = '<i class="fa fa-plus"></i>'; // replace with your html content
          }
...

Hope it helps.