mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #14759 from overleaf/mj-table-insert-float-specifier
[visual] Remove float specifier from inserted table GitOrigin-RevId: b24c945117dfb52dd2982d6787985bf4554f5526
This commit is contained in:
parent
a080c7294b
commit
9d3461157c
1 changed files with 10 additions and 5 deletions
|
@ -70,13 +70,18 @@ export const insertFigure: Command = view => {
|
|||
|
||||
export const insertTable = (view: EditorView, sizeX: number, sizeY: number) => {
|
||||
const { state, dispatch } = view
|
||||
const visual = isVisual(view)
|
||||
const placeholder = visual ? '' : '#{}'
|
||||
const placeholderAtStart = visual ? '#{}' : ''
|
||||
const { pos, suffix } = ensureEmptyLine(state, state.selection.main)
|
||||
const template = `\n\\begin{table}[#{}]
|
||||
const template = `${placeholderAtStart}\n\\begin{table}
|
||||
\t\\centering
|
||||
\\begin{tabular}{${'c'.repeat(sizeX)}}
|
||||
${('\t\t' + '#{} & #{}'.repeat(sizeX - 1) + '\\\\\n').repeat(
|
||||
sizeY
|
||||
)}\\end{tabular}
|
||||
\t\\begin{tabular}{${'c'.repeat(sizeX)}}
|
||||
${(
|
||||
'\t\t' +
|
||||
`${placeholder} & ${placeholder}`.repeat(sizeX - 1) +
|
||||
'\\\\\n'
|
||||
).repeat(sizeY)}\t\\end{tabular}
|
||||
\t\\caption{Caption}
|
||||
\t\\label{tab:my_label}
|
||||
\\end{table}${suffix}`
|
||||
|
|
Loading…
Reference in a new issue