@@ -12,62 +12,70 @@ module.exports = function initTables(_module, wysiwyg) {
1212 cols = cols || 3 ;
1313 rows = rows || 2 ;
1414
15- var table = "|" ;
15+ var table = '|' ;
1616
1717 for ( var col = 0 ; col < cols ; col ++ ) {
18- table = table + " col" + col + " |" ;
18+ table = table + ' col' + col + ' |' ;
1919 }
2020
21- table = table + " \n|" ;
21+ table = table + ' \n|' ;
2222
2323 for ( var col = 0 ; col < cols ; col ++ ) {
24- table = table + " ------|" ;
24+ table = table + ' ------|' ;
2525 }
2626
27- table = table + "\n" ;
27+ table = table + '\n' ;
2828
2929 for ( var row = 0 ; row < rows ; row ++ ) {
30- table = table + "|" ;
30+ table = table + '|' ;
3131
3232 for ( var col = 0 ; col < cols ; col ++ ) {
33- table = table + " cell |" ;
33+ table = table + ' cell |' ;
3434 }
3535
36- table = table + "\n" ;
36+ table = table + '\n' ;
3737 }
3838
39- return table + "\n" ;
39+ return table + '\n' ;
4040 }
4141
42-
4342 // create a submenu for sizing tables
44- $ ( '.wk-commands' ) . append ( '<button class="woofmark-command-table btn btn-outline-secondary" data-toggle="table" title="Table <table>"><i class="fa fa-table"></i></button>' ) ;
43+ $ ( '.wk-commands' ) . append (
44+ '<button class="woofmark-command-table btn btn-outline-secondary" data-toggle="table" title="Table <table>"><i class="fa fa-table"></i></button>'
45+ ) ;
4546
4647 $ ( document ) . ready ( function ( ) {
4748 $ ( '[data-toggle="table"]' ) . tooltip ( ) ;
4849 } ) ;
4950
50- var builder = '<div class="form-inline form-group ple-table-popover" style="width:400px;">' ;
51- builder += '<a id="decRows" class="btn btn-sm btn-outline-secondary"><i class="fa fa-minus"></i></a> <span id="tableRows">4</span> <a id="incRows" class="btn btn-sm btn-outline-secondary"><i class="fa fa-plus"></i></a>' ;
51+ var builder =
52+ '<div class="form-inline form-group ple-table-popover" style="width:400px;">' ;
53+ builder +=
54+ '<a id="decRows" class="btn btn-sm btn-outline-secondary"><i class="fa fa-minus"></i></a> <span id="tableRows">4</span> <a id="incRows" class="btn btn-sm btn-outline-secondary"><i class="fa fa-plus"></i></a>' ;
5255 builder += ' x ' ;
53- builder += '<a id="decCols" class="btn btn-sm btn-outline-secondaryt"><i class="fa fa-minus"></i></a> <span id="tableCols">3</span> <a id="incCols" class="btn btn-sm btn-outline-secondary"><i class="fa fa-plus"></i></a>' ;
54- builder += ' <a class="ple-table-size btn btn-outline-secondary">Add</a>' ;
56+ builder +=
57+ '<a id="decCols" class="btn btn-sm btn-outline-secondaryt"><i class="fa fa-minus"></i></a> <span id="tableCols">3</span> <a id="incCols" class="btn btn-sm btn-outline-secondary"><i class="fa fa-plus"></i></a>' ;
58+ builder +=
59+ ' <a class="ple-table-size btn btn-outline-secondary">Add</a>' ;
5560 builder += '</div>' ;
5661
5762 $ ( '.woofmark-command-table' ) . attr ( 'data-content' , builder ) ;
5863
59-
6064 $ ( document ) . on ( 'click' , '#incRows' , function ( ) {
61- $ ( " #tableRows" ) . text ( Number ( $ ( " #tableRows" ) . text ( ) ) + 1 ) ;
65+ $ ( ' #tableRows' ) . text ( Number ( $ ( ' #tableRows' ) . text ( ) ) + 1 ) ;
6266 } ) ;
6367 $ ( document ) . on ( 'click' , '#decRows' , function ( ) {
64- $ ( "#tableRows" ) . text ( Number ( $ ( "#tableRows" ) . text ( ) ) - 1 ) ;
68+ if ( Number ( $ ( '#tableRows' ) . text ( ) ) > 1 ) {
69+ $ ( '#tableRows' ) . text ( Number ( $ ( '#tableRows' ) . text ( ) ) - 1 ) ;
70+ }
6571 } ) ;
6672 $ ( document ) . on ( 'click' , '#incCols' , function ( ) {
67- $ ( " #tableCols" ) . text ( Number ( $ ( " #tableCols" ) . text ( ) ) + 1 ) ;
73+ $ ( ' #tableCols' ) . text ( Number ( $ ( ' #tableCols' ) . text ( ) ) + 1 ) ;
6874 } ) ;
6975 $ ( document ) . on ( 'click' , '#decCols' , function ( ) {
70- $ ( "#tableCols" ) . text ( Number ( $ ( "#tableCols" ) . text ( ) ) - 1 ) ;
76+ if ( Number ( $ ( '#tableCols' ) . text ( ) ) > 1 ) {
77+ $ ( '#tableCols' ) . text ( Number ( $ ( '#tableCols' ) . text ( ) ) - 1 ) ;
78+ }
7179 } ) ;
7280
7381 $ ( '.woofmark-command-table' ) . attr ( 'data-content' , builder ) ;
0 commit comments