Project

General

Profile

Feature #1575 » 0001-feature-1575-patch-with-table-icon.patch

Mizuki ISHIKAWA, 2020-02-21 08:16

View differences:

public/javascripts/jstoolbar/jstoolbar.js
});
return false;
};
/* Table generator */
jsToolBar.prototype.tableMenu = function(fn){
var alphabets = "ABCDEFGHIJ".split('');
var menu = $("<table class='table-generator'></table>");
for (var r = 1; r <= 5; r++) {
var row = $("<tr></tr>").appendTo(menu);
for (var c = 1; c <= 10; c++) {
$("<td data-row="+r+" data-col="+c+" title="+(c)+'&times;'+(r)+"></td>").mousedown(function(){
fn(alphabets.slice(0, $(this).data('col')), $(this).data('row'));
}).hover(function(){
var hoverRow = $(this).data('row');
var hoverCol = $(this).data('col');
$(this).closest('table').find('td').each(function(_index, element){
if ($(element).data('row') <= hoverRow && $(element).data('col') <= hoverCol){
$(element).addClass('selected-cell');
} else {
$(element).removeClass('selected-cell');
}
});
}).appendTo(row);
}
}
$("body").append(menu);
menu.position({
my: "left top",
at: "left bottom",
of: this.toolNodes['table']
});
$(document).on("mousedown", function() {
menu.remove();
});
return false;
};
public/javascripts/jstoolbar/lang/jstoolbar-en.js
jsToolBar.strings['Ordered list'] = 'Ordered list';
jsToolBar.strings['Quote'] = 'Quote';
jsToolBar.strings['Unquote'] = 'Remove Quote';
jsToolBar.strings['Table'] = 'Table';
jsToolBar.strings['Preformatted text'] = 'Preformatted text';
jsToolBar.strings['Wiki link'] = 'Link to a Wiki page';
jsToolBar.strings['Image'] = 'Image';
public/javascripts/jstoolbar/markdown.js
}
}
// table
jsToolBar.prototype.elements.table = {
type: 'button',
title: 'Table',
fn: {
wiki: function() {
var This = this;
this.tableMenu(function(cols, rowCount){
This.encloseLineSelection(('|'+cols.join(' |')+' |\n') + ('|--'.repeat(cols.length)+'|\n') + (('| '.repeat(cols.length))+'|\n').repeat(rowCount));
});
}
}
}
// pre
jsToolBar.prototype.elements.pre = {
type: 'button',
public/javascripts/jstoolbar/textile.js
}
}
// table
jsToolBar.prototype.elements.table = {
type: 'button',
title: 'Table',
fn: {
wiki: function() {
var This = this;
this.tableMenu(function(cols, rowCount){
This.encloseLineSelection(('|_.'+cols.join('|_.')+'|\n') + (('| '.repeat(cols.length))+'|\n').repeat(rowCount));
});
}
}
}
// pre
jsToolBar.prototype.elements.pre = {
type: 'button',
public/stylesheets/jstoolbar.css
.jstElements .help { float: right; margin-right: 0.5em; padding-top: 8px; font-size: 0.9em; }
.jstElements .help a {padding: 2px 0 2px 20px; background: url(../images/help.png) no-repeat 0 50%;}
.table-generator td {
position: relative;
border: 2px solid #ccc;
background-color: white;
padding: 10px;
cursor: pointer;
}
.table-generator td.selected-cell, .table-generator td:hover {
background-color: #759FCF;
}
.table-generator {
position: absolute;
border-collapse: collapse;
}
/* Buttons
-------------------------------------------------------- */
.jstb_strong {
......
.jstb_img {
background-image: url(../images/jstoolbar/bt_img.png);
}
.jstb_table {
background-image: url(../images/jstoolbar/bt_table.png);
}
.jstb_help {
background-image: url(../images/help.png);
}
(6-6/12)