From 8f9f2686e33659fd3f139590daca730c1015f99c Mon Sep 17 00:00:00 2001 From: dzonidoo Date: Thu, 16 Nov 2023 15:57:08 +0100 Subject: [PATCH] Revert "Fix table width (#4380)" This reverts commit 43f988f0d86de73565a57895240776981f2aca00. --- .../components/multi-line-quote/MultiLineQuote.tsx | 5 +---- .../core/editor3/components/tables/TableBlock.tsx | 11 +++-------- scripts/core/editor3/components/tables/TableCell.tsx | 12 ++---------- .../core/editor3/components/tests/tables.spec.tsx | 1 - .../core/editor3/html/to-html/AtomicBlockParser.ts | 3 +-- 5 files changed, 7 insertions(+), 25 deletions(-) diff --git a/scripts/core/editor3/components/multi-line-quote/MultiLineQuote.tsx b/scripts/core/editor3/components/multi-line-quote/MultiLineQuote.tsx index 8f7c47998b..d3e2e582dc 100644 --- a/scripts/core/editor3/components/multi-line-quote/MultiLineQuote.tsx +++ b/scripts/core/editor3/components/multi-line-quote/MultiLineQuote.tsx @@ -5,8 +5,6 @@ import {EditorState, ContentBlock} from 'draft-js'; import {TableBlock} from '../tables/TableBlock'; import {IActiveCell} from 'superdesk-api'; -export const MULTI_LINE_QUOTE_CLASS = 'multi-line-quote'; - interface IProps { block: ContentBlock; readOnly: boolean; @@ -26,8 +24,7 @@ export class MultiLineQuoteComponent extends React.Component { render() { return ( { 'table-header': withHeader, }); - const fullWidthStyle = this.props.fullWidth ? {width: '100%'} : {}; - return (
{ this.onMouseDown(e); }} > - - +
+ {Array.from(new Array(numRows)).map((_, i) => ( - + {Array.from(new Array(numCols)).map((__, j) => ( 0} key={`cell-${i}-${j}-${numRows}-${numCols}`} readOnly={this.props.readOnly} editorState={this.getCellEditorState(data, i, j)} diff --git a/scripts/core/editor3/components/tables/TableCell.tsx b/scripts/core/editor3/components/tables/TableCell.tsx index f1220180fa..712f5746c9 100644 --- a/scripts/core/editor3/components/tables/TableCell.tsx +++ b/scripts/core/editor3/components/tables/TableCell.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import PropTypes from 'prop-types'; import {Editor, RichUtils, getDefaultKeyBinding, DraftHandleValue, SelectionState, EditorState} from 'draft-js'; import {getSelectedEntityType, getSelectedEntityRange} from '../links/entityUtils'; import {customStyleMap} from '../customStyleMap'; @@ -10,7 +11,6 @@ interface IProps { onUndo: () => void; onRedo: () => void; onFocus: (styles: Array, selection: SelectionState) => void; - fullWidth?: boolean; } interface IState { @@ -185,17 +185,9 @@ export class TableCell extends React.Component { render() { const {editorState} = this.state; const {readOnly} = this.props; - const fullWidthStyle = this.props.fullWidth ? {width: '100%'} : {}; return ( -
{ - e.preventDefault(); - }} - style={fullWidthStyle} - onClick={(event) => event.stopPropagation()} - > + event.stopPropagation()}> { it('should render', () => { const wrapper = shallow( { /* no-op */ }} readOnly={false} diff --git a/scripts/core/editor3/html/to-html/AtomicBlockParser.ts b/scripts/core/editor3/html/to-html/AtomicBlockParser.ts index b215327998..e4143ebed9 100644 --- a/scripts/core/editor3/html/to-html/AtomicBlockParser.ts +++ b/scripts/core/editor3/html/to-html/AtomicBlockParser.ts @@ -3,7 +3,6 @@ import {isQumuWidget, postProccessQumuEmbed} from '../../components/embeds/QumuW import {logger} from 'core/services/logger'; import {editor3StateToHtml} from './editor3StateToHtml'; import {getData, IEditor3TableData} from 'core/editor3/helpers/table'; -import {MULTI_LINE_QUOTE_CLASS} from 'core/editor3/components/multi-line-quote/MultiLineQuote'; /** * @ngdoc class @@ -201,7 +200,7 @@ export class AtomicBlockParser { } const {cells} = data; - let html = `
`; + let html = '
'; const cellContentState = cells[0]?.[0] != null ? convertFromRaw(cells[0][0]) : ContentState.createFromText('');