This commit is contained in:
Keegan George 2022-07-28 07:43:23 -07:00
commit 695980a250
17 changed files with 36054 additions and 33561 deletions

View File

@ -1,6 +1,6 @@
{
"extends": "eslint-config-discourse",
"ignorePatterns": ["javascripts/vendor/*"],
"ignorePatterns": ["javascripts/vendor/*", "assets/vendor/*"],
"globals": {
"settings": "readonly",
"themePrefix": "readonly"

View File

@ -9,8 +9,8 @@
"minimum_discourse_version": null,
"maximum_discourse_version": null,
"assets": {
"jsuites": "assets/jsuites.js",
"jspreadsheet": "assets/jspreadsheet.js"
"jsuites": "assets/vendor/jsuites.js",
"jspreadsheet": "assets/vendor/jspreadsheet.js"
},
"modifiers": {
"svg_icons": [

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

14970
assets/vendor/jspreadsheet.js vendored Normal file

File diff suppressed because it is too large Load Diff

12268
assets/vendor/jsuites.js vendored Normal file

File diff suppressed because it is too large Load Diff

88
build.bash Normal file
View File

@ -0,0 +1,88 @@
#!/bin/bash
# Global Variables:
SCSS_VENDOR=scss/vendor/
JS_VENDOR=assets/vendor/
JSUITES_JS_URL="https://jsuites.net/v4/jsuites.js"
JSPREADSHEET_JS_URL="https://bossanova.uk/jspreadsheet/v4/jexcel.js"
JSUITES_CSS_URL="https://raw.githubusercontent.com/jsuites/jsuites/master/dist/jsuites.basic.css"
JSPREADSHEET_CSS_URL="https://bossanova.uk/jspreadsheet/v4/jexcel.css"
JSUITES_CSS_FILE=jsuites.basic.css
JSUITES_SCSS_FILE=jsuites.scss
JSUITES_SCSS_FILE_LOCATION=$SCSS_VENDOR$JSUITES_SCSS_FILE
JSUITES_JS_FILE=jsuites.js
JSUITES_NEW_JS_FILE=jsuites.js
JSUITES_JS_FILE_LOCATION=$JS_VENDOR$JSUITES_NEW_JS_FILE
JSPREADSHEET_CSS_FILE=jexcel.css
JSPREADSHEET_SCSS_FILE=jspreadsheet.scss
JSPREADSHEET_SCSS_FILE_LOCATION=$SCSS_VENDOR$JSPREADSHEET_SCSS_FILE
JSPREADSHEET_JS_FILE=jexcel.js
JSPREADSHEET_NEW_JS_FILE=jspreadsheet.js
JSPREADSHEET_JS_FILE_LOCATION=$JS_VENDOR$JSPREADSHEET_NEW_JS_FILE
# Remove all vendor related files:
rm -r ${SCSS_VENDOR}*
rm -r ${JS_VENDOR}
# Recreate vendor directory
mkdir $JS_VENDOR
echo "Old vendor assets have been removed."
# STYLESHEETS:
# Add JSuite vendor file
if test -f "$JSUITES_CSS_FILE"; then
echo "$JSUITES_CSS_FILE already exists."
else
# Fetch jsuite stylesheet
wget $JSUITES_CSS_URL
echo "$JSUITES_CSS_FILE has been created in $(pwd)"
# Move jsuite stylesheet to vendor as a scss file
mv $JSUITES_CSS_FILE $JSUITES_SCSS_FILE_LOCATION
echo "$JSUITES_SCSS_FILE has been placed in the scss vendor directory"
# Scope styles to jexcel_container class
sed -i '' '1s/^/.jexcel_container {\n/' $JSUITES_SCSS_FILE_LOCATION
sed -i '' '$a\
}' $JSUITES_SCSS_FILE_LOCATION
# Remove conflicting animation classes
# TODO: Improve below code to handle nested code blocks
fi
# Add JSpreadsheet vendor file
if test -f "$JSPREADSHEET_CSS_FILE"; then
echo "$JSPREADSHEET_CSS_FILE already exists."
else
# Fetch jspreadsheet stylesheet
wget $JSPREADSHEET_CSS_URL
echo "$JSPREADSHEET_CSS_FILE has been created in $(pwd)"
# Move jspreadsheet stylesheet to vendor as a scss file
mv $JSPREADSHEET_CSS_FILE $JSPREADSHEET_SCSS_FILE_LOCATION
fi
# Apply prettier to vendor files
yarn prettier --write $SCSS_VENDOR
# JAVASCRIPTS:
if test -f "$JSUITES_JS_FILE"; then
echo "$JSUITES_JS_FILE already exists."
else
wget $JSUITES_JS_URL
mv $JSUITES_JS_FILE $JSUITES_JS_FILE_LOCATION
fi
if test -f "$JSPREADSHEET_JS_FILE"; then
echo "$JSPREADSHEET_JS_FILE already exists."
else
wget $JSPREADSHEET_JS_URL
mv $JSPREADSHEET_JS_FILE $JSPREADSHEET_JS_FILE_LOCATION
fi

View File

@ -1,6 +1,5 @@
@import "vendor/jspreadsheet";
@import "vendor/jspreadsheet-datatables";
@import "vendor/jspreadsheet-theme";
@import "vendor/jsuites";
@import "theme/jspreadsheet-theme";
@import "post/table-edit-decorator";
@import "modal/insert-table-modal";

View File

@ -6,6 +6,7 @@ import { iconNode } from "discourse-common/lib/icon-library";
import { create } from "virtual-dom";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
export default apiInitializer("0.11.1", (api) => {
const site = api.container.lookup("site:main");
const currentUser = api.getCurrentUser();

View File

@ -7,6 +7,7 @@ import { popupAjaxError } from "discourse/lib/ajax-error";
import I18n from "I18n";
import { schedule } from "@ember/runloop";
import { tracked } from "@glimmer/tracking";
export default class SpreadsheetEditor extends GlimmerComponent {
@tracked showEditReason = false;
spreadsheet = null;

5966
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,13 @@
{
"name": "discourse-table-builder",
"description": "Create and edit markdown tables using a spreadsheet editor.",
"version": "0.0.1",
"repository": "https://github.com/keegangeorge/discourse-table-builder",
"author": "Keegan George",
"license": "GPL-2.0-or-later",
"scripts": {
"build": "bash ./build.bash"
},
"devDependencies": {
"eslint-config-discourse": "latest"
}

View File

@ -27,6 +27,21 @@
background-color: transparent;
}
table.jexcel > thead > tr > td {
border-top: 1px solid transparent;
border-left: 1px solid transparent;
border-right: 1px solid transparent;
border-bottom: 1px solid #000;
background-color: #fff;
padding: 10px;
font-weight: bold;
}
table.jexcel > tbody > tr > td {
padding: 8px;
border-right: 1px solid transparent;
border-left: 1px solid transparent;
}
table.jexcel {
border-bottom: 1px solid var(--jexcel_border_color);
}

View File

@ -1,85 +0,0 @@
table.jexcel {
border-right: 1px solid transparent;
}
table.jexcel > thead {
background-color: #fff;
}
table.jexcel > thead > tr > td {
border-top: 1px solid transparent;
border-left: 1px solid transparent;
border-right: 1px solid transparent;
border-bottom: 1px solid #000;
background-color: #fff;
padding: 10px;
font-weight: bold;
}
table.jexcel > thead > tr > td.selected {
background-color: #eee;
}
table.jexcel > tbody > tr > td {
padding: 8px;
border-right: 1px solid transparent;
border-left: 1px solid transparent;
}
table.jexcel > tbody > tr > td:first-child {
background-color: #fff;
}
table.jexcel > tbody > tr.selected > td:first-child {
background-color: #eee;
}
.jexcel_toolbar {
background-color: transparent;
border: 0px;
border-bottom: 1px solid #ccc;
border-top: 1px solid #ccc;
margin-bottom: 0px;
}
.jexcel_pagination > div > div {
border: 1px solid transparent;
background-color: #fff;
}
.jexcel_page_selected {
background: linear-gradient(to bottom, #fff 0%, #dcdcdc 100%);
border: 1px solid #979797 !important;
font-weight: normal;
color: #333 !important;
border-radius: 2px;
}
/*.jexcel > div > table > tbody > tr,
.jexcel > div > table > thead
{
border-left:1px solid transparent;
}
.jexcel > div > table > tbody > tr > td
{
padding:10px;
border-right:1px solid transparent;
}
.jexcel > div > table > tbody > td.edition
{
padding:0px;
padding-left:4px;
}
.jexcel > div > table > tbody > tr > td:first-child
{
background-color:#fff;
font-weight:bold;
}
.jexcel > div > table > tbody > tr.selected > td:first-child
{
background-color:#eee;
}
.jexcel > div > table > thead > tr > td.selected
{
background-color:#eee;
}*/

View File

@ -410,6 +410,7 @@
-khtml-user-drag: none;
-moz-user-drag: none;
-o-user-drag: none;
user-drag: none;
}
.jexcel_textarea {

1898
scss/vendor/jsuites.scss vendored

File diff suppressed because it is too large Load Diff

556
yarn.lock

File diff suppressed because it is too large Load Diff