bootstrap-wysiwyg icon indicating copy to clipboard operation
bootstrap-wysiwyg copied to clipboard

table toolbar?

Open mauseq opened this issue 8 years ago • 5 comments

Hi, is the plugin able to insert and manage tables?

mauseq avatar Jan 12 '17 09:01 mauseq

No, we have not implemented anything like that.

codewithtyler avatar Jan 12 '17 18:01 codewithtyler

I did it like this. Inside of execcommand I put a switch case with the built in code as the default behavior and one of the cases is 'insertCols' which corresponds to a button I created with control to dictate how many columns of what size. This actually implements bootstrap girds not real tables but you could just as easily make tables.

 case 'insertCols':
                           //var numCols = document.getElementById('num_cols');
                           var colWidths = document.getElementsByClassName('colWidthSelector');
                           var row = document.createElement('div');
                           var cols = [];
                           row.className = 'row';
                           for(var x = 0; x < colWidths.length; x++){
                               cols.push( document.createElement('div'));
                               cols[x].className = 'innerCol showBorder  contents col-md-' + colWidths[x].value;
                               cols[x].contentEditable = true;
                               cols[x].style.minHeight = '30px';
                               row.appendChild(cols[x]);
                               row.contentEditable = false;
                           }
                           selectedRange.insertNode(row);
                        
                           break;

icandothat2 avatar May 29 '18 20:05 icandothat2

Do you think there is an advantage to bootstrap grids over regular tables? I wonder if the editor will handling pasting data from something like a spreadsheet better if we implement tables?

steveathon avatar May 30 '18 01:05 steveathon

I don't think there is a general benefit to using grids over tables. I have a site that uses grids and I wanted to stick with that. If you're trying to handle pasting from a spreadsheet I don't know if the browser would be table to tell, maybe IE can, I'm not sure. That's an interesting idea.

On Tue, May 29, 2018 at 6:55 PM, Steve King [email protected] wrote:

Do you think there is an advantage to bootstrap grids over regular tables? I wonder if the editor will handling pasting data from something like a spreadsheet better if we implement tables?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/steveathon/bootstrap-wysiwyg/issues/108#issuecomment-393005106, or mute the thread https://github.com/notifications/unsubscribe-auth/APcqjO1znrW_JNzkeCY3b_EVwKClaZJIks5t3fwlgaJpZM4LhiUI .

icandothat2 avatar May 30 '18 02:05 icandothat2

While many sites still stick to tables for layout, they are certainly seeing less use in recent years with the advent of Bootstrap grids and I'd imagine even less so once everyone becomes familiar with the awesome CSS Grids! The more complicated your table layout, the more difficult it becomes to manage/maintain your layout with traditional table elements. I don't suppose it really matters much which you choose in this case though...

spreadred avatar May 30 '18 21:05 spreadred