Skip to content
Snippets Groups Projects
Commit 0254f2ec authored by Christos's avatar Christos
Browse files

Merge branch 'tables-caption' into 'master'

Tables caption

See merge request !488
parents 90815956 f452b463
No related branches found
No related tags found
1 merge request!488Tables caption
Showing
with 121 additions and 32 deletions
......@@ -15,6 +15,10 @@ module.exports = function override(config, env) {
__dirname,
'../../wax-questions-service/index',
),
'wax-table-service': path.resolve(
__dirname,
'../../wax-table-service/index',
),
},
};
config.module = {
......
......@@ -6,7 +6,6 @@
"@guardian/prosemirror-invisibles": "^1.2.0",
"@pubsweet/ui-toolkit": "^2.3.1",
"fontsource-merriweather": "^3.0.9",
"prosemirror-tables": "1.3.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-panelgroup": "^1.0.10",
......@@ -16,7 +15,8 @@
"typeface-vollkorn": "^0.0.54",
"wax-prosemirror-core": "^0.8.9",
"wax-prosemirror-services": "^0.8.9",
"wax-questions-service": "^0.8.9"
"wax-questions-service": "^0.8.9",
"wax-table-service": "^0.8.9"
},
"scripts": {
"start": "react-app-rewired start",
......
import { emDash, ellipsis } from 'prosemirror-inputrules';
import { debounce } from 'lodash';
import { columnResizing, tableEditing } from 'prosemirror-tables';
import {
InlineAnnotationsService,
AnnotationToolGroupService,
......@@ -9,7 +9,6 @@ import {
LinkService,
ListsService,
ListToolGroupService,
TablesService,
BaseService,
BaseToolGroupService,
DisplayBlockLevelService,
......@@ -48,6 +47,8 @@ import {
// TitleToolGroupService,
} from 'wax-prosemirror-services';
import { TablesService, tableEditing, columnResizing } from 'wax-table-service';
import { EditoriaSchema } from 'wax-prosemirror-core';
import invisibles, {
......@@ -150,8 +151,8 @@ export default {
},
},
PmPlugins: [
columnResizing(),
tableEditing(),
columnResizing(),
invisibles([hardBreak()]),
disallowPasteImagesPlugin(() =>
onWarning(
......
import { emDash, ellipsis } from 'prosemirror-inputrules';
import { columnResizing, tableEditing } from 'prosemirror-tables';
import {
AnnotationToolGroupService,
ImageService,
......@@ -7,7 +6,6 @@ import {
LinkService,
ListsService,
ListToolGroupService,
TablesService,
BaseService,
BaseToolGroupService,
DisplayBlockLevelService,
......@@ -35,6 +33,8 @@ import {
CustomTagService,
} from 'wax-prosemirror-services';
import { TablesService, tableEditing, columnResizing } from 'wax-table-service';
import { DefaultSchema } from 'wax-prosemirror-core';
import invisibles, {
......@@ -79,7 +79,7 @@ export default {
TitleService: { updateTitle },
EnableTrackChangeService: { enabled: false },
PmPlugins: [columnResizing(), tableEditing(), invisibles([hardBreak()])],
PmPlugins: [invisibles([hardBreak()])],
CustomTagService: {
tags: [
{ label: 'custom-tag-label-1', tagType: 'inline' },
......
import { emDash, ellipsis } from 'prosemirror-inputrules';
import { columnResizing, tableEditing } from 'prosemirror-tables';
import {
InlineAnnotationsService,
AnnotationToolGroupService,
......@@ -8,7 +7,6 @@ import {
LinkService,
ListsService,
ListToolGroupService,
TablesService,
BaseService,
BaseToolGroupService,
DisplayTextToolGroupService,
......@@ -19,6 +17,7 @@ import {
} from 'wax-prosemirror-services';
import { QuestionsService } from 'wax-questions-service';
import { TablesService, tableEditing, columnResizing } from 'wax-table-service';
import { DefaultSchema } from 'wax-prosemirror-core';
import invisibles, { hardBreak } from '@guardian/prosemirror-invisibles';
......@@ -130,7 +129,7 @@ export default {
RulesService: [emDash, ellipsis],
ImageService: { showAlt: true },
PmPlugins: [columnResizing(), tableEditing(), invisibles([hardBreak()])],
PmPlugins: [invisibles([hardBreak()])],
services: [
// new ExternalAPIContentService(),
new QuestionsService(),
......
import { emDash, ellipsis } from 'prosemirror-inputrules';
import { debounce } from 'lodash';
import { columnResizing, tableEditing } from 'prosemirror-tables';
import {
InlineAnnotationsService,
AnnotationToolGroupService,
......@@ -9,7 +9,6 @@ import {
LinkService,
ListsService,
ListToolGroupService,
TablesService,
BaseService,
BaseToolGroupService,
DisplayBlockLevelService,
......@@ -47,6 +46,7 @@ import {
OENContainersToolGroupService,
OENAsideToolGroupService,
} from 'wax-prosemirror-services';
import { TablesService, tableEditing, columnResizing } from 'wax-table-service';
import { EditoriaSchema } from 'wax-prosemirror-core';
......@@ -191,7 +191,7 @@ export default {
reject: true,
},
},
PmPlugins: [columnResizing(), tableEditing(), invisibles([hardBreak()])],
PmPlugins: [invisibles([hardBreak()])],
CustomTagService: {
tags: [
{ label: 'custom-tag-label-1', tagType: 'inline' },
......
......@@ -14,6 +14,7 @@
"wax-prosemirror-core",
"wax-prosemirror-services",
"wax-questions-service",
"wax-table-service",
"editors/*"
],
"scripts": {
......
......@@ -30,11 +30,5 @@ export default {
commonjs(),
terser(),
],
external: [
'react-dropdown',
'uuid',
'prop-types',
'prosemirror-tables',
'wax-prosemirror-services',
],
external: [],
};
......@@ -96,8 +96,11 @@ const createTable = (colsRows, state, dispatch) => {
rows.push(state.config.schema.nodes.table_row.createAndFill(null, cells));
}
const table = state.config.schema.nodes.table.createAndFill(null, rows);
dispatch(state.tr.replaceSelectionWith(table));
const tableBody = state.config.schema.nodes.table_body.createAndFill(
null,
rows,
);
dispatch(state.tr.replaceSelectionWith(tableBody));
};
const createLink = (state, dispatch) => {
......
......@@ -5,7 +5,6 @@ export { default as BaseService } from './src/BaseService/BaseService';
export { default as ImageService } from './src/ImageService/ImageService';
export { default as InlineAnnotationsService } from './src/InlineAnnotations/InlineAnnotationsService';
export { default as ListsService } from './src/ListsService/ListsService';
export { default as TablesService } from './src/TablesService/TablesService';
export { default as TextBlockLevelService } from './src/TextBlockLevel/TextBlockLevelService';
export { default as DisplayBlockLevelService } from './src/DisplayBlockLevel/DisplayBlockLevelService';
export { default as NoteService } from './src/NoteService/NoteService';
......
......@@ -29,7 +29,6 @@
"prosemirror-model": "1.19.0",
"prosemirror-schema-list": "1.3.0",
"prosemirror-state": "1.4.2",
"prosemirror-tables": "1.3.4",
"prosemirror-transform": "1.7.1",
"prosemirror-view": "1.30.2",
"react-dropdown": "^1.6.2",
......
......@@ -40,12 +40,7 @@ export default {
'uuid',
'react',
'react-dom',
'react-dropdown',
'lodash',
'prosemirror-tables',
'prosemirror-schema-list',
'prosemirror-model',
'prosemirror-inputrules',
'@babel/runtime/regenerator',
],
};
## Wax table package
export { tableEditing, columnResizing } from './src/tableSrc';
export { default as TablesService } from './src/TablesService';
{
"name": "wax-table-service",
"author": "Christos Kokosias & Giannis Kopanas",
"version": "0.8.9",
"description": "Wax Table Service",
"license": "MIT",
"main": "dist/index.js",
"style": "dist/index.css",
"files": [
"dist"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "BABEL_ENV=production rollup -c"
},
"dependencies": {
"@pubsweet/ui-toolkit": "^2.3.1",
"inversify": "^5.0.1",
"lodash": "^4.17.4",
"uuid": "^7.0.3",
"prosemirror-keymap": "1.2.1",
"prosemirror-state": "1.4.2",
"prosemirror-view": "1.30.2",
"prosemirror-transform": "1.7.1",
"wax-prosemirror-core": "^0.8.9",
"wax-prosemirror-services": "^0.8.9"
},
"devDependencies": {
"mocha": "^3.4.2",
"prosemirror-test-builder": "^1.0.1"
},
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"styled-components": "^5.3.1"
}
}
import babel from 'rollup-plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import external from 'rollup-plugin-peer-deps-external';
import css from 'rollup-plugin-import-css';
import { terser } from 'rollup-plugin-terser';
export default {
input: 'index.js',
output: [
{
file: 'dist/index.js',
format: 'cjs',
sourcemap: false,
},
],
plugins: [
css(),
external({
includeDependencies: true,
}),
babel({
presets: ['react-app'],
plugins: [
[
'@babel/plugin-transform-runtime',
{
regenerator: true,
},
],
['@babel/plugin-proposal-decorators', { legacy: true }],
'babel-plugin-parameter-decorator',
],
exclude: 'node_modules/**',
runtimeHelpers: true,
}),
commonjs(),
terser(),
],
external: ['uuid', 'react', 'react-dom', 'lodash', 'prosemirror-model'],
};
/* eslint-disable camelcase */
import { Service } from 'wax-prosemirror-core';
import { tableNodes, goToNextCell } from 'prosemirror-tables';
import { tableNodes, goToNextCell } from '../tableSrc';
import Table from './Table';
class InsertTableService extends Service {
......@@ -8,7 +9,14 @@ class InsertTableService extends Service {
const CreateShortCut = this.container.get('CreateShortCut');
// eslint-disable-next-line camelcase
const { table, table_row, table_cell, table_header } = tableNodes({
const {
table,
table_row,
table_caption,
table_body,
table_cell,
table_header,
} = tableNodes({
tableGroup: 'block',
cellContent: 'block+',
});
......@@ -17,6 +25,12 @@ class InsertTableService extends Service {
createNode({
table,
});
createNode({
table_caption,
});
createNode({
table_body,
});
createNode({
table_row,
});
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment