- Improve DOCX rendering fidelity, pagination, image handling, and Markdown paste - Expand PDF text editing with paragraph reflow, style preservation, and more reliable text matching - Harden XLSX sheet deletion, localized date formats, multi-row autofit, charts, and system font support - Add inline AI turn rollback and sent-attachment visibility across editors - Add Office-style ScreenTips and refine ribbons, dialogs, menus, and themes - Improve Slides cropping, rotate and flip tools, printing, animations, and editing workflows - Add shell settings, configurable save locations, account credits, and update recovery guidance - Add Intel macOS and RPM download support and refresh public documentation Co-authored-by: GenOffice <merrick-2002@users.noreply.github.com>
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { Editor } from '@tiptap/core'
|
|
import { noteMarkText, toRoman } from '../src/renderer/note-format'
|
|
import { editorExtensions } from '../src/renderer/editor/extensions'
|
|
|
|
describe('note numbering', () => {
|
|
it('endnotes number in lowercase roman, footnotes stay arabic', () => {
|
|
expect(toRoman(1)).toBe('i')
|
|
expect(toRoman(4)).toBe('iv')
|
|
expect(toRoman(9)).toBe('ix')
|
|
expect(toRoman(14)).toBe('xiv')
|
|
expect(noteMarkText('endnote', 3)).toBe('iii')
|
|
expect(noteMarkText('footnote', 3)).toBe('3')
|
|
})
|
|
|
|
it('in-text reference marks render roman for endnotes', () => {
|
|
const editor = new Editor({
|
|
element: document.createElement('div'),
|
|
extensions: editorExtensions,
|
|
content: {
|
|
type: 'doc',
|
|
content: [
|
|
{
|
|
type: 'docParagraph',
|
|
content: [
|
|
{ type: 'text', text: '正文' },
|
|
{ type: 'docNoteRef', attrs: { kind: 'footnote', id: 'f1', num: 2 } },
|
|
{ type: 'docNoteRef', attrs: { kind: 'endnote', id: 'e1', num: 2 } },
|
|
],
|
|
},
|
|
],
|
|
} as never,
|
|
})
|
|
// bare number/roman text: the editor-only brackets are CSS ::before/::after
|
|
// (hidden in print so they don't leak into exported PDF text)
|
|
const sups = [...editor.view.dom.querySelectorAll('sup[data-note-ref]')]
|
|
expect(sups.map((s) => s.textContent)).toEqual(['2', 'ii'])
|
|
editor.destroy()
|
|
})
|
|
})
|