@procore/text-editor 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/codemod/__fixtures__/hammer.config.mjs +7 -0
- package/codemod/__fixtures__/procore.config.js +7 -0
- package/codemod/text-editor-migrate.js +227 -1
- package/codemod/text-editor-migrate.test.js +67 -0
- package/dist/{src/TextEditor → TextEditor}/TextEditor.d.ts +1 -1
- package/dist/TextEditor/TextEditor.js +2 -12
- package/dist/TextEditor/TextEditor.js.map +1 -1
- package/dist/TextEditor/TextEditor.styles.js +1 -1
- package/dist/{src/TextEditor → TextEditor}/TextEditor.types.d.ts +0 -38
- package/dist/TextEditor/TextEditor.types.js.map +1 -1
- package/dist/TextEditor/utils/config.js +2 -1
- package/dist/TextEditor/utils/config.js.map +1 -1
- package/dist/TextEditorOutput/TextEditorOutput.styles.js +1 -1
- package/dist/_typedoc/TextEditor/TextEditor.types.json +16 -68
- package/dist/_typedoc/TextEditor/TextEditorProvider.types.json +2 -2
- package/dist/_typedoc/TextEditorOutput/TextEditorOutput.types.json +3 -3
- package/dist/_typedoc/deprecations.json +1 -1
- package/package.json +5 -5
- package/dist/codemod/__fixtures__/src/components/ComplexEditor.d.ts +0 -2
- package/dist/codemod/__fixtures__/src/components/FormWithRichText.d.ts +0 -2
- package/dist/codemod/__fixtures__/src/components/MultilineFormRichText.d.ts +0 -2
- package/dist/codemod/__fixtures__/src/components/NoTextEditor.d.ts +0 -2
- package/dist/codemod/__fixtures__/src/components/ReadOnlyRichText.d.ts +0 -2
- package/dist/codemod/__fixtures__/src/components/SimpleEditor.d.ts +0 -2
- package/dist/codemod/__fixtures__/src/components/TypeImportEditor.d.ts +0 -2
- /package/dist/{src/TextEditor → TextEditor}/EditorError.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/StickyToolbar/index.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/StickyToolbar/useStickyToolbar.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/StickyToolbar/useStickyToolbar.types.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/TextEditor.styles.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/TextEditorProvider.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/TextEditorProvider.types.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/index.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/license_key.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/plugins/CutPlugin/CutCommand.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/plugins/CutPlugin/CutPlugin.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/plugins/CutPlugin/index.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/plugins/IndentPaddingToMarginPlugin/IndentPaddingToMarginPlugin.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/plugins/IndentPaddingToMarginPlugin/index.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/plugins/PasteAsTextPlugin/PasteAsTextCommand.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/plugins/PasteAsTextPlugin/PasteAsTextPlugin.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/plugins/PasteAsTextPlugin/index.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/plugins/PastePlugin/PasteCommand.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/plugins/PastePlugin/PastePlugin.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/plugins/PastePlugin/index.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/plugins/TabSpacesPlugin/TabSpacesPlugin.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/plugins/TabSpacesPlugin/index.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/textEditorTheming/icons.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/textEditorTheming/index.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/textEditorTheming/textEditorTheming.styles.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/useCKEditorCss.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/useTabAsNavigation.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/utils/config.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/utils/index.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/utils/locale.d.ts +0 -0
- /package/dist/{src/TextEditor → TextEditor}/utils/plugins.d.ts +0 -0
- /package/dist/{src/TextEditorOutput → TextEditorOutput}/TextEditorOutput.d.ts +0 -0
- /package/dist/{src/TextEditorOutput → TextEditorOutput}/TextEditorOutput.styles.d.ts +0 -0
- /package/dist/{src/TextEditorOutput → TextEditorOutput}/TextEditorOutput.types.d.ts +0 -0
- /package/dist/{src/TextEditorOutput → TextEditorOutput}/TextEditorOutput.utils.d.ts +0 -0
- /package/dist/{src/TextEditorOutput → TextEditorOutput}/index.d.ts +0 -0
- /package/dist/{src/_storyHelpers → _storyHelpers}/constants.d.ts +0 -0
- /package/dist/{src/_utils → _utils}/propsTypedoc.d.ts +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{src/stories → stories}/util.d.ts +0 -0
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* 1. Updates imports from @procore/core-react to @procore/text-editor for TextEditor components
|
|
9
9
|
* 2. Updates Form.RichText usage to include textEditorComponent prop
|
|
10
10
|
* 3. Updates Jest configuration to use textEditorJestConfig
|
|
11
|
+
* 4. Adds ckeditor5 singleton to module federation shared config
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
const fs = require('fs')
|
|
@@ -28,9 +29,43 @@ const stats = {
|
|
|
28
29
|
importsUpdated: 0,
|
|
29
30
|
formRichTextUpdated: 0,
|
|
30
31
|
jestConfigUpdated: 0,
|
|
32
|
+
moduleFederationUpdated: 0,
|
|
31
33
|
errors: [],
|
|
32
34
|
}
|
|
33
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Check if ckeditor5 is in package.json dependencies
|
|
38
|
+
*/
|
|
39
|
+
function checkForCkeditor5(targetPath) {
|
|
40
|
+
let currentDir = targetPath
|
|
41
|
+
|
|
42
|
+
// If targetPath is a file, start from its directory
|
|
43
|
+
if (fs.existsSync(targetPath) && fs.statSync(targetPath).isFile()) {
|
|
44
|
+
currentDir = path.dirname(targetPath)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Walk up the directory tree to find package.json
|
|
48
|
+
while (currentDir !== path.dirname(currentDir)) {
|
|
49
|
+
const packageJsonPath = path.join(currentDir, 'package.json')
|
|
50
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
51
|
+
try {
|
|
52
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
|
|
53
|
+
const deps = {
|
|
54
|
+
...packageJson.dependencies,
|
|
55
|
+
...packageJson.devDependencies,
|
|
56
|
+
...packageJson.peerDependencies,
|
|
57
|
+
}
|
|
58
|
+
return !!deps['ckeditor5']
|
|
59
|
+
} catch (error) {
|
|
60
|
+
// Ignore parse errors, continue searching
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
currentDir = path.dirname(currentDir)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return false
|
|
67
|
+
}
|
|
68
|
+
|
|
34
69
|
// TextEditor-related exports that should be migrated
|
|
35
70
|
const TEXT_EDITOR_EXPORTS = [
|
|
36
71
|
'TextEditor',
|
|
@@ -254,6 +289,161 @@ function transformFormRichText(fileContent) {
|
|
|
254
289
|
return { content: newContent, modified }
|
|
255
290
|
}
|
|
256
291
|
|
|
292
|
+
/**
|
|
293
|
+
* Transform module federation configuration to add ckeditor5 singleton
|
|
294
|
+
* Handles both hammer.config.* and procore.config.* files
|
|
295
|
+
*/
|
|
296
|
+
function transformModuleFederation(fileContent, filePath) {
|
|
297
|
+
let modified = false
|
|
298
|
+
let newContent = fileContent
|
|
299
|
+
const fileName = path.basename(filePath)
|
|
300
|
+
|
|
301
|
+
// Only process hammer.config.* or procore.config.* files
|
|
302
|
+
if (
|
|
303
|
+
!fileName.startsWith('hammer.config') &&
|
|
304
|
+
!fileName.startsWith('procore.config')
|
|
305
|
+
) {
|
|
306
|
+
return { content: newContent, modified }
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// Check if moduleFederation.shared exists in the file
|
|
310
|
+
if (!newContent.includes('moduleFederation')) {
|
|
311
|
+
return { content: newContent, modified }
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// Check if shared key exists
|
|
315
|
+
if (!newContent.includes('shared')) {
|
|
316
|
+
return { content: newContent, modified }
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Check if ckeditor5 is already configured
|
|
320
|
+
if (newContent.includes('ckeditor5')) {
|
|
321
|
+
return { content: newContent, modified }
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Pattern to match shared object in moduleFederation
|
|
325
|
+
// Handles both `shared: {` and `shared:{` patterns
|
|
326
|
+
const sharedObjectRegex = /(shared\s*:\s*\{)/g
|
|
327
|
+
|
|
328
|
+
if (sharedObjectRegex.test(newContent)) {
|
|
329
|
+
// Reset regex lastIndex
|
|
330
|
+
sharedObjectRegex.lastIndex = 0
|
|
331
|
+
|
|
332
|
+
// Find the match and its position
|
|
333
|
+
const match = sharedObjectRegex.exec(newContent)
|
|
334
|
+
if (match) {
|
|
335
|
+
const insertPosition = match.index + match[0].length
|
|
336
|
+
|
|
337
|
+
// Detect indentation by looking at the content after `shared: {`
|
|
338
|
+
// Find the first property inside shared to determine proper indentation
|
|
339
|
+
const afterShared = newContent.substring(insertPosition)
|
|
340
|
+
const firstPropertyMatch = afterShared.match(/\n(\s+)\w+\s*:/)
|
|
341
|
+
|
|
342
|
+
let propertyIndent = ''
|
|
343
|
+
let indentUnit = ' ' // default to 2 spaces
|
|
344
|
+
|
|
345
|
+
if (firstPropertyMatch) {
|
|
346
|
+
// Use the same indentation as the first property inside shared
|
|
347
|
+
propertyIndent = firstPropertyMatch[1]
|
|
348
|
+
// Detect indent unit from the property indent
|
|
349
|
+
const sharedLineMatch = newContent
|
|
350
|
+
.substring(0, match.index)
|
|
351
|
+
.match(/\n(\s+)shared/)
|
|
352
|
+
if (sharedLineMatch) {
|
|
353
|
+
const sharedIndent = sharedLineMatch[1]
|
|
354
|
+
// indentUnit is the difference between property indent and shared indent
|
|
355
|
+
if (propertyIndent.length > sharedIndent.length) {
|
|
356
|
+
indentUnit = propertyIndent.substring(sharedIndent.length)
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
} else {
|
|
360
|
+
// Fallback: detect from the 'shared' line indentation
|
|
361
|
+
const beforeMatch = newContent.substring(0, match.index)
|
|
362
|
+
const lastNewlineIndex = beforeMatch.lastIndexOf('\n')
|
|
363
|
+
const lineStart =
|
|
364
|
+
lastNewlineIndex >= 0
|
|
365
|
+
? beforeMatch.substring(lastNewlineIndex + 1)
|
|
366
|
+
: beforeMatch
|
|
367
|
+
const baseIndentMatch = lineStart.match(/^(\s*)/)
|
|
368
|
+
const baseIndent = baseIndentMatch ? baseIndentMatch[1] : ''
|
|
369
|
+
|
|
370
|
+
// Determine if we're using tabs or spaces
|
|
371
|
+
const useTabs = baseIndent.includes('\t')
|
|
372
|
+
indentUnit = useTabs ? '\t' : ' '
|
|
373
|
+
propertyIndent = baseIndent + indentUnit
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// Build the ckeditor5 configuration
|
|
377
|
+
const ckeditor5Config = `
|
|
378
|
+
${propertyIndent}ckeditor5: {
|
|
379
|
+
${propertyIndent}${indentUnit}requiredVersion: deps['ckeditor5'],
|
|
380
|
+
${propertyIndent}${indentUnit}singleton: true,
|
|
381
|
+
${propertyIndent}},`
|
|
382
|
+
|
|
383
|
+
// Insert the ckeditor5 configuration after `shared: {`
|
|
384
|
+
newContent =
|
|
385
|
+
newContent.substring(0, insertPosition) +
|
|
386
|
+
ckeditor5Config +
|
|
387
|
+
newContent.substring(insertPosition)
|
|
388
|
+
|
|
389
|
+
// Check if deps variable is already declared
|
|
390
|
+
if (
|
|
391
|
+
!newContent.includes("require('./package.json')") &&
|
|
392
|
+
!newContent.includes("require('./package.json').dependencies") &&
|
|
393
|
+
!newContent.includes("from './package.json'")
|
|
394
|
+
) {
|
|
395
|
+
// Add deps declaration at the top of the file
|
|
396
|
+
// Determine if using CommonJS or ES modules
|
|
397
|
+
const isESModule =
|
|
398
|
+
newContent.includes('export default') ||
|
|
399
|
+
newContent.includes('export {') ||
|
|
400
|
+
filePath.endsWith('.mjs')
|
|
401
|
+
|
|
402
|
+
if (isESModule) {
|
|
403
|
+
// For ES modules, add import at the top
|
|
404
|
+
const importStatement =
|
|
405
|
+
"import deps from './package.json' with { type: 'json' }\n"
|
|
406
|
+
|
|
407
|
+
// Find the first import or export statement
|
|
408
|
+
const firstImportMatch = newContent.match(/^(import|export)/m)
|
|
409
|
+
if (firstImportMatch) {
|
|
410
|
+
const insertPos = newContent.indexOf(firstImportMatch[0])
|
|
411
|
+
newContent =
|
|
412
|
+
newContent.substring(0, insertPos) +
|
|
413
|
+
importStatement +
|
|
414
|
+
newContent.substring(insertPos)
|
|
415
|
+
} else {
|
|
416
|
+
newContent = importStatement + newContent
|
|
417
|
+
}
|
|
418
|
+
} else {
|
|
419
|
+
// For CommonJS, add require at the top
|
|
420
|
+
const requireStatement =
|
|
421
|
+
"const deps = require('./package.json').dependencies\n"
|
|
422
|
+
|
|
423
|
+
// Find the first require or const statement
|
|
424
|
+
const firstRequireMatch = newContent.match(
|
|
425
|
+
/^(const|let|var|require)/m
|
|
426
|
+
)
|
|
427
|
+
if (firstRequireMatch) {
|
|
428
|
+
const insertPos = newContent.indexOf(firstRequireMatch[0])
|
|
429
|
+
newContent =
|
|
430
|
+
newContent.substring(0, insertPos) +
|
|
431
|
+
requireStatement +
|
|
432
|
+
newContent.substring(insertPos)
|
|
433
|
+
} else {
|
|
434
|
+
newContent = requireStatement + newContent
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
modified = true
|
|
440
|
+
stats.moduleFederationUpdated++
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
return { content: newContent, modified }
|
|
445
|
+
}
|
|
446
|
+
|
|
257
447
|
/**
|
|
258
448
|
* Transform Jest configuration files
|
|
259
449
|
*/
|
|
@@ -326,6 +516,15 @@ function processFile(filePath) {
|
|
|
326
516
|
}
|
|
327
517
|
}
|
|
328
518
|
|
|
519
|
+
// Process module federation configuration for hammer.config.* and procore.config.* files
|
|
520
|
+
if (isConfigFile) {
|
|
521
|
+
const modFedResult = transformModuleFederation(newContent, filePath)
|
|
522
|
+
if (modFedResult.modified) {
|
|
523
|
+
newContent = modFedResult.content
|
|
524
|
+
wasModified = true
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
329
528
|
// For regular JS/TS files, process imports and Form.RichText
|
|
330
529
|
if (['.js', '.jsx', '.ts', '.tsx'].includes(ext) && !isConfigFile) {
|
|
331
530
|
// Transform imports
|
|
@@ -420,6 +619,7 @@ ${colors.bold}Transformations:${colors.reset}
|
|
|
420
619
|
• Updates imports from @procore/core-react to @procore/text-editor
|
|
421
620
|
• Adds textEditorComponent prop to Form.RichText
|
|
422
621
|
• Updates Jest configuration to use textEditorJestConfig
|
|
622
|
+
• Adds ckeditor5 singleton to module federation shared config
|
|
423
623
|
|
|
424
624
|
${colors.bold}Examples:${colors.reset}
|
|
425
625
|
|
|
@@ -433,6 +633,24 @@ ${colors.bold}Examples:${colors.reset}
|
|
|
433
633
|
// Default to current directory if no path provided
|
|
434
634
|
const targetPath = path.resolve(args[0] || '.')
|
|
435
635
|
|
|
636
|
+
// Check if ckeditor5 is installed before running
|
|
637
|
+
if (!checkForCkeditor5(targetPath)) {
|
|
638
|
+
console.log(
|
|
639
|
+
`\n${colors.info}ℹ${colors.reset} ckeditor5 not found in package.json\n`
|
|
640
|
+
)
|
|
641
|
+
console.log(`Are you sure you need a text-editor?\n`)
|
|
642
|
+
console.log(
|
|
643
|
+
` To use TextEditor components, you need to install ckeditor5 first:\n`
|
|
644
|
+
)
|
|
645
|
+
console.log(` ${colors.info}For libraries:${colors.reset}`)
|
|
646
|
+
console.log(` yarn add ckeditor5@^47 --peer --dev\n`)
|
|
647
|
+
console.log(` ${colors.info}For apps:${colors.reset}`)
|
|
648
|
+
console.log(` yarn add ckeditor5@^47\n`)
|
|
649
|
+
console.log(` After installing, re-run this codemod.\n`)
|
|
650
|
+
console.log(` See README_MIGRATION.md for more details.\n`)
|
|
651
|
+
return
|
|
652
|
+
}
|
|
653
|
+
|
|
436
654
|
console.log(
|
|
437
655
|
`\n${colors.bold}Starting TextEditor migration...${colors.reset}\n`
|
|
438
656
|
)
|
|
@@ -488,6 +706,9 @@ ${colors.bold}Examples:${colors.reset}
|
|
|
488
706
|
console.log(
|
|
489
707
|
`${colors.success}✓${colors.reset} Jest configs updated: ${stats.jestConfigUpdated}`
|
|
490
708
|
)
|
|
709
|
+
console.log(
|
|
710
|
+
`${colors.success}✓${colors.reset} Module federation configs updated: ${stats.moduleFederationUpdated}`
|
|
711
|
+
)
|
|
491
712
|
|
|
492
713
|
if (stats.errors.length > 0) {
|
|
493
714
|
console.log(`\n${colors.error}Errors encountered:${colors.reset}`)
|
|
@@ -501,7 +722,12 @@ ${colors.bold}Examples:${colors.reset}
|
|
|
501
722
|
if (stats.filesProcessed > 0) {
|
|
502
723
|
console.log(`${colors.bold}Next steps:${colors.reset}\n`)
|
|
503
724
|
console.log('1. Review the changes made by the codemod')
|
|
504
|
-
console.log(
|
|
725
|
+
console.log(
|
|
726
|
+
'2. Review previous implementation for additional props and migrate to CKEditor, https://ckeditor.com/docs/ckeditor5/latest/features/index.html\n'
|
|
727
|
+
)
|
|
728
|
+
console.log(
|
|
729
|
+
'3. Run your tests to ensure everything works correctly and test a deploy preview.\n'
|
|
730
|
+
)
|
|
505
731
|
}
|
|
506
732
|
}
|
|
507
733
|
|
|
@@ -169,6 +169,73 @@ describe('text-editor-migrate codemod', () => {
|
|
|
169
169
|
})
|
|
170
170
|
})
|
|
171
171
|
|
|
172
|
+
describe('module federation transformations', () => {
|
|
173
|
+
it('should add ckeditor5 to moduleFederation.shared in hammer.config.mjs', () => {
|
|
174
|
+
execFileSync('node', [codemodPath, testDir], { stdio: 'ignore' })
|
|
175
|
+
|
|
176
|
+
const content = readFile('hammer.config.mjs')
|
|
177
|
+
|
|
178
|
+
expect(content).toContain('ckeditor5:')
|
|
179
|
+
expect(content).toContain("requiredVersion: deps['ckeditor5']")
|
|
180
|
+
expect(content).toContain('singleton: true')
|
|
181
|
+
expect(content).toContain("import deps from './package.json'")
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
it('should add ckeditor5 to moduleFederation.shared in procore.config.js', () => {
|
|
185
|
+
execFileSync('node', [codemodPath, testDir], { stdio: 'ignore' })
|
|
186
|
+
|
|
187
|
+
const content = readFile('procore.config.js')
|
|
188
|
+
|
|
189
|
+
expect(content).toContain('ckeditor5:')
|
|
190
|
+
expect(content).toContain("requiredVersion: deps['ckeditor5']")
|
|
191
|
+
expect(content).toContain('singleton: true')
|
|
192
|
+
expect(content).toContain(
|
|
193
|
+
"const deps = require('./package.json').dependencies"
|
|
194
|
+
)
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
it('should not add ckeditor5 if already present', () => {
|
|
198
|
+
// First run adds ckeditor5
|
|
199
|
+
execFileSync('node', [codemodPath, testDir], { stdio: 'ignore' })
|
|
200
|
+
const firstRun = readFile('hammer.config.mjs')
|
|
201
|
+
|
|
202
|
+
// Second run should not duplicate
|
|
203
|
+
execFileSync('node', [codemodPath, testDir], { stdio: 'ignore' })
|
|
204
|
+
const secondRun = readFile('hammer.config.mjs')
|
|
205
|
+
|
|
206
|
+
expect(firstRun).toBe(secondRun)
|
|
207
|
+
// Count occurrences of ckeditor5 - should only appear once
|
|
208
|
+
const matches = secondRun.match(/ckeditor5:/g)
|
|
209
|
+
expect(matches).toHaveLength(1)
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
it('should not modify config files without moduleFederation.shared', () => {
|
|
213
|
+
// Create a config file without moduleFederation
|
|
214
|
+
const noModFedConfig = `
|
|
215
|
+
const { coreReactJestConfig } = require('@procore/core-react/jestConfig')
|
|
216
|
+
|
|
217
|
+
module.exports = {
|
|
218
|
+
app: {
|
|
219
|
+
webpackOverride(config) {
|
|
220
|
+
return config
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
}
|
|
224
|
+
`
|
|
225
|
+
fs.writeFileSync(
|
|
226
|
+
path.join(testDir, 'no-mod-fed.config.js'),
|
|
227
|
+
noModFedConfig
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
execFileSync('node', [codemodPath, testDir], { stdio: 'ignore' })
|
|
231
|
+
|
|
232
|
+
const content = readFile('no-mod-fed.config.js')
|
|
233
|
+
|
|
234
|
+
expect(content).not.toContain('ckeditor5')
|
|
235
|
+
expect(content).not.toContain("require('./package.json')")
|
|
236
|
+
})
|
|
237
|
+
})
|
|
238
|
+
|
|
172
239
|
describe('edge cases', () => {
|
|
173
240
|
it('should not modify files without TextEditor usage', () => {
|
|
174
241
|
execFileSync('node', [codemodPath, testDir], { stdio: 'ignore' })
|
|
@@ -41,4 +41,4 @@ import type { TextEditorProps } from './TextEditor.types';
|
|
|
41
41
|
* }),
|
|
42
42
|
* })
|
|
43
43
|
*/
|
|
44
|
-
export declare function TextEditor({ disabled, error, value, initialValue, onChange, onInit, onBlur, onKeyDown, config: externalConfig, plugins: stringPlugins, locale: propLocale, onDirty,
|
|
44
|
+
export declare function TextEditor({ disabled, error, value, initialValue, onChange, onInit, onBlur, onKeyDown, config: externalConfig, plugins: stringPlugins, locale: propLocale, onDirty, ...restProps }: TextEditorProps): React.JSX.Element | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["disabled", "error", "value", "initialValue", "onChange", "onInit", "onBlur", "onKeyDown", "config", "plugins", "locale", "onDirty"
|
|
2
|
+
var _excluded = ["disabled", "error", "value", "initialValue", "onChange", "onInit", "onBlur", "onKeyDown", "config", "plugins", "locale", "onDirty"];
|
|
3
3
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -17,7 +17,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
17
17
|
import { CKEditor } from '@ckeditor/ckeditor5-react';
|
|
18
18
|
import { ClassicEditor } from 'ckeditor5';
|
|
19
19
|
import React from 'react';
|
|
20
|
-
import {
|
|
20
|
+
import { useI18nContext, useZIndexContext } from '@procore/core-react';
|
|
21
21
|
import { useStickyToolbar } from './StickyToolbar';
|
|
22
22
|
import { GlobalEditorStyles, StyledTextEditor } from './TextEditor.styles';
|
|
23
23
|
import { TextEditorContext } from './TextEditorProvider';
|
|
@@ -80,10 +80,6 @@ export function TextEditor(_ref) {
|
|
|
80
80
|
stringPlugins = _ref.plugins,
|
|
81
81
|
propLocale = _ref.locale,
|
|
82
82
|
onDirty = _ref.onDirty,
|
|
83
|
-
_tinyMCE = _ref.tinyMCE,
|
|
84
|
-
_init = _ref.init,
|
|
85
|
-
_onEditorChange = _ref.onEditorChange,
|
|
86
|
-
_onFocusOut = _ref.onFocusOut,
|
|
87
83
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
88
84
|
var _useCKEditorCss = useCKEditorCss(),
|
|
89
85
|
cssLoading = _useCKEditorCss.isLoading;
|
|
@@ -135,12 +131,6 @@ export function TextEditor(_ref) {
|
|
|
135
131
|
var finalConfig = _objectSpread(_objectSpread({}, configWithPlugins), externalResult !== null && externalResult !== void 0 ? externalResult : {});
|
|
136
132
|
return finalConfig;
|
|
137
133
|
}, [externalConfig, locale, stringPlugins]);
|
|
138
|
-
var focusScope = UNSAFE_useOverridableFocusScope();
|
|
139
|
-
React.useEffect(function () {
|
|
140
|
-
focusScope.setProps({
|
|
141
|
-
contain: false
|
|
142
|
-
});
|
|
143
|
-
}, [focusScope]);
|
|
144
134
|
var bindKeyDownHandler = React.useCallback(function (editor) {
|
|
145
135
|
if (!onKeyDown) {
|
|
146
136
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.js","names":["CKEditor","ClassicEditor","React","UNSAFE_useOverridableFocusScope","useI18nContext","useZIndexContext","useStickyToolbar","GlobalEditorStyles","StyledTextEditor","TextEditorContext","TextEditorTheme","useCKEditorCss","useTabAsNavigation","addButtonDataAttributes","addPluginsFromStringArray","getDefaultConfig","TextEditor","_ref","disabled","error","value","initialValue","onChange","onInit","onBlur","onKeyDown","externalConfig","config","stringPlugins","plugins","propLocale","locale","onDirty","_tinyMCE","tinyMCE","_init","init","_onEditorChange","onEditorChange","_onFocusOut","onFocusOut","restProps","_objectWithoutProperties","_excluded","_useCKEditorCss","cssLoading","isLoading","editorRef","useRef","editorInstanceRef","initialValueRef","keyDownListenerRef","_React$useState","useState","_React$useState2","_slicedToArray","isDirtyState","setIsDirtyState","_React$useState3","_React$useState4","isEditorReady","setIsEditorReady","_useI18nContext","contextLocale","useEffect","undefined","current","editing","view","document","off","_useZIndexContext","zIndex","_React$useContext","useContext","features","enableStickyToolbar","stickyToolbar","enableTabAsNavigation","tabAsNavigation","mergedConfig","useMemo","defaultConfig","configWithPlugins","length","externalResult","finalConfig","_objectSpread","focusScope","setProps","contain","bindKeyDownHandler","useCallback","editor","editorElement","getRoot","keyDownListener","_event","data","domEvent","on","handleChange","getData","isDirty","handleReady","setData","handleBlur","event","enabled","_useTabAsNavigation","editorKey","concat","createElement","ref","key","_extends","onReady"],"sources":["../../src/TextEditor/TextEditor.tsx"],"sourcesContent":["import { CKEditor } from '@ckeditor/ckeditor5-react'\nimport type { EditorConfig } from 'ckeditor5'\nimport { ClassicEditor, type EventInfo } from 'ckeditor5'\nimport React from 'react'\n\nimport {\n UNSAFE_useOverridableFocusScope,\n useI18nContext,\n useZIndexContext,\n} from '@procore/core-react'\nimport { useStickyToolbar } from './StickyToolbar'\nimport { GlobalEditorStyles, StyledTextEditor } from './TextEditor.styles'\nimport type { KeyDownListener, TextEditorProps } from './TextEditor.types'\nimport { TextEditorContext } from './TextEditorProvider'\nimport { TextEditorTheme } from './textEditorTheming'\nimport { useCKEditorCss } from './useCKEditorCss'\nimport { useTabAsNavigation } from './useTabAsNavigation'\nimport {\n addButtonDataAttributes,\n addPluginsFromStringArray,\n getDefaultConfig,\n} from './utils'\n\n/**\n * To ensure your Jest tests work with the CKEditor implementation, wrap your Jest configuration with `textEditorJestConfig`:\n *\n * @example\n *\n * // Using Jest config file\n *\n * const { textEditorJestConfig } = require('@procore/text-editor/jestConfig')\n *\n * module.exports = textEditorJestConfig({\n * // Your existing Jest config\n * })\n *\n * @example\n *\n * // Using Hammer\n *\n * import { textEditorJestConfig } from '@procore/text-editor/jestConfig'\n *\n * export default {\n * testJest: (defaultConfig) =>\n * textEditorJestConfig({\n * ...defaultConfig,\n * // Your existing Jest config\n * }),\n * }\n *\n * @example\n *\n * // Using Core Scripts\n *\n * const { textEditorJestConfig } = require('@procore/text-editor/jestConfig')\n *\n * module.exports = () => ({\n * jestOverride: (defaultConfig) =>\n * textEditorJestConfig({\n * ...defaultConfig,\n * // Your existing Jest config\n * }),\n * })\n */\nexport function TextEditor({\n disabled,\n error,\n value,\n initialValue,\n onChange,\n onInit,\n onBlur,\n onKeyDown,\n config: externalConfig,\n plugins: stringPlugins,\n locale: propLocale,\n onDirty,\n // Deprecated TinyMCE props - no-op for backward compatibility\n tinyMCE: _tinyMCE,\n init: _init,\n onEditorChange: _onEditorChange,\n onFocusOut: _onFocusOut,\n ...restProps\n}: TextEditorProps) {\n const { isLoading: cssLoading } = useCKEditorCss()\n\n const editorRef = React.useRef<HTMLDivElement>(null)\n const editorInstanceRef = React.useRef<ClassicEditor | null>(null)\n const initialValueRef = React.useRef<string>(value || initialValue || '')\n const keyDownListenerRef = React.useRef<KeyDownListener | null>(null)\n const [isDirtyState, setIsDirtyState] = React.useState(false)\n const [isEditorReady, setIsEditorReady] = React.useState(false)\n const { locale: contextLocale } = useI18nContext()\n const locale = propLocale || contextLocale\n\n React.useEffect(() => {\n if (value !== undefined) {\n initialValueRef.current = value\n }\n }, [value])\n\n // Cleanup keydown listener on unmount\n React.useEffect(() => {\n return () => {\n if (keyDownListenerRef.current && editorInstanceRef.current) {\n editorInstanceRef.current.editing.view.document.off(\n 'keydown',\n keyDownListenerRef.current\n )\n keyDownListenerRef.current = null\n }\n }\n }, [])\n\n const { value: zIndex } = useZIndexContext()\n\n const { features } = React.useContext(TextEditorContext)\n const enableStickyToolbar = !!features?.stickyToolbar\n const enableTabAsNavigation = !!features?.tabAsNavigation\n\n const mergedConfig = React.useMemo(() => {\n const defaultConfig = getDefaultConfig(locale)\n\n // Handle string plugins for backward compatibility\n const configWithPlugins = stringPlugins?.length\n ? addPluginsFromStringArray(defaultConfig, stringPlugins)\n : defaultConfig\n\n // Apply any external CKEditor config overrides provided by the consumer\n const externalResult =\n typeof externalConfig === 'function'\n ? externalConfig(configWithPlugins)\n : undefined\n // Merge default config (with plugins) and consumer overrides\n let finalConfig: EditorConfig = {\n ...configWithPlugins,\n ...(externalResult ?? {}),\n }\n\n return finalConfig\n }, [externalConfig, locale, stringPlugins])\n\n const focusScope = UNSAFE_useOverridableFocusScope()\n React.useEffect(() => {\n focusScope.setProps({ contain: false })\n }, [focusScope])\n\n const bindKeyDownHandler = React.useCallback(\n (editor: ClassicEditor) => {\n if (!onKeyDown) {\n return\n }\n\n const editorElement = editor.editing.view.document.getRoot()\n if (!editorElement) {\n return\n }\n\n // Remove existing keydown listener\n if (keyDownListenerRef.current) {\n editor.editing.view.document.off('keydown', keyDownListenerRef.current)\n }\n\n // Create and store the new listener\n const keyDownListener = (\n _event: EventInfo,\n data: { domEvent: Event }\n ) => {\n const domEvent = data.domEvent as KeyboardEvent\n onKeyDown(domEvent, editor)\n }\n\n keyDownListenerRef.current = keyDownListener\n\n // Add the keydown listener\n editor.editing.view.document.on('keydown', keyDownListener)\n },\n [onKeyDown]\n )\n\n const handleChange = (\n _event: EventInfo<string, unknown>,\n editor: ClassicEditor\n ) => {\n const data = editor.getData()\n const isDirty = data !== initialValueRef.current\n\n // Call onDirty only on first content modification\n if (isDirty && !isDirtyState) {\n setIsDirtyState(true)\n onDirty?.()\n }\n\n onChange?.(data, isDirty)\n }\n\n const handleReady = (editor: ClassicEditor) => {\n addButtonDataAttributes(editor)\n editorInstanceRef.current = editor\n setIsEditorReady(true)\n\n if (initialValue) {\n editor.setData(initialValue)\n }\n\n // Bind keydown handler when editor is ready\n bindKeyDownHandler(editor)\n\n onInit?.(editor)\n }\n\n const handleBlur = (\n event: EventInfo<string, unknown>,\n editor: ClassicEditor\n ) => {\n onBlur?.(event, editor)\n }\n\n useStickyToolbar({\n enabled: enableStickyToolbar,\n editor: isEditorReady ? editorInstanceRef.current : null,\n editorRef,\n cssLoading,\n })\n\n const { config } = useTabAsNavigation({\n config: mergedConfig,\n enabled: enableTabAsNavigation,\n editor: isEditorReady ? editorInstanceRef.current : null,\n })\n\n const editorKey = `${locale}-${enableTabAsNavigation}`\n\n if (cssLoading) {\n return null\n }\n\n return (\n <StyledTextEditor ref={editorRef} key={editorKey} error={error}>\n <GlobalEditorStyles zIndex={zIndex + 1} />\n <TextEditorTheme />\n <CKEditor\n {...restProps}\n editor={ClassicEditor}\n config={config}\n disabled={disabled}\n data={value}\n onChange={handleChange}\n onReady={handleReady}\n onBlur={handleBlur}\n />\n </StyledTextEditor>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAASA,QAAQ,QAAQ,2BAA2B;AAEpD,SAASC,aAAa,QAAwB,WAAW;AACzD,OAAOC,KAAK,MAAM,OAAO;AAEzB,SACEC,+BAA+B,EAC/BC,cAAc,EACdC,gBAAgB,QACX,qBAAqB;AAC5B,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,kBAAkB,EAAEC,gBAAgB,QAAQ,qBAAqB;AAE1E,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SACEC,uBAAuB,EACvBC,yBAAyB,EACzBC,gBAAgB,QACX,SAAS;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAAC,IAAA,EAmBN;EAAA,IAlBlBC,QAAQ,GAAAD,IAAA,CAARC,QAAQ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or","React","useI18nContext","useZIndexContext","useStickyToolbar","GlobalEditorStyles","StyledTextEditor","TextEditorContext","TextEditorTheme","useCKEditorCss","useTabAsNavigation","addButtonDataAttributes","addPluginsFromStringArray","getDefaultConfig","TextEditor","_ref","disabled","error","value","initialValue","onChange","onInit","onBlur","onKeyDown","externalConfig","config","stringPlugins","plugins","propLocale","locale","onDirty","restProps","_objectWithoutProperties","_excluded","_useCKEditorCss","cssLoading","isLoading","editorRef","useRef","editorInstanceRef","initialValueRef","keyDownListenerRef","_React$useState","useState","_React$useState2","_slicedToArray","isDirtyState","setIsDirtyState","_React$useState3","_React$useState4","isEditorReady","setIsEditorReady","_useI18nContext","contextLocale","useEffect","undefined","current","editing","view","document","off","_useZIndexContext","zIndex","_React$useContext","useContext","features","enableStickyToolbar","stickyToolbar","enableTabAsNavigation","tabAsNavigation","mergedConfig","useMemo","defaultConfig","configWithPlugins","length","externalResult","finalConfig","_objectSpread","bindKeyDownHandler","useCallback","editor","editorElement","getRoot","keyDownListener","_event","data","domEvent","on","handleChange","getData","isDirty","handleReady","setData","handleBlur","event","enabled","_useTabAsNavigation","editorKey","concat","createElement","ref","key","_extends","onReady"],"sources":["../../src/TextEditor/TextEditor.tsx"],"sourcesContent":["import { CKEditor } from '@ckeditor/ckeditor5-react'\nimport type { EditorConfig } from 'ckeditor5'\nimport { ClassicEditor, type EventInfo } from 'ckeditor5'\nimport React from 'react'\n\nimport { useI18nContext, useZIndexContext } from '@procore/core-react'\nimport { useStickyToolbar } from './StickyToolbar'\nimport { GlobalEditorStyles, StyledTextEditor } from './TextEditor.styles'\nimport type { KeyDownListener, TextEditorProps } from './TextEditor.types'\nimport { TextEditorContext } from './TextEditorProvider'\nimport { TextEditorTheme } from './textEditorTheming'\nimport { useCKEditorCss } from './useCKEditorCss'\nimport { useTabAsNavigation } from './useTabAsNavigation'\nimport {\n addButtonDataAttributes,\n addPluginsFromStringArray,\n getDefaultConfig,\n} from './utils'\n\n/**\n * To ensure your Jest tests work with the CKEditor implementation, wrap your Jest configuration with `textEditorJestConfig`:\n *\n * @example\n *\n * // Using Jest config file\n *\n * const { textEditorJestConfig } = require('@procore/text-editor/jestConfig')\n *\n * module.exports = textEditorJestConfig({\n * // Your existing Jest config\n * })\n *\n * @example\n *\n * // Using Hammer\n *\n * import { textEditorJestConfig } from '@procore/text-editor/jestConfig'\n *\n * export default {\n * testJest: (defaultConfig) =>\n * textEditorJestConfig({\n * ...defaultConfig,\n * // Your existing Jest config\n * }),\n * }\n *\n * @example\n *\n * // Using Core Scripts\n *\n * const { textEditorJestConfig } = require('@procore/text-editor/jestConfig')\n *\n * module.exports = () => ({\n * jestOverride: (defaultConfig) =>\n * textEditorJestConfig({\n * ...defaultConfig,\n * // Your existing Jest config\n * }),\n * })\n */\nexport function TextEditor({\n disabled,\n error,\n value,\n initialValue,\n onChange,\n onInit,\n onBlur,\n onKeyDown,\n config: externalConfig,\n plugins: stringPlugins,\n locale: propLocale,\n onDirty,\n ...restProps\n}: TextEditorProps) {\n const { isLoading: cssLoading } = useCKEditorCss()\n\n const editorRef = React.useRef<HTMLDivElement>(null)\n const editorInstanceRef = React.useRef<ClassicEditor | null>(null)\n const initialValueRef = React.useRef<string>(value || initialValue || '')\n const keyDownListenerRef = React.useRef<KeyDownListener | null>(null)\n const [isDirtyState, setIsDirtyState] = React.useState(false)\n const [isEditorReady, setIsEditorReady] = React.useState(false)\n const { locale: contextLocale } = useI18nContext()\n const locale = propLocale || contextLocale\n\n React.useEffect(() => {\n if (value !== undefined) {\n initialValueRef.current = value\n }\n }, [value])\n\n // Cleanup keydown listener on unmount\n React.useEffect(() => {\n return () => {\n if (keyDownListenerRef.current && editorInstanceRef.current) {\n editorInstanceRef.current.editing.view.document.off(\n 'keydown',\n keyDownListenerRef.current\n )\n keyDownListenerRef.current = null\n }\n }\n }, [])\n\n const { value: zIndex } = useZIndexContext()\n\n const { features } = React.useContext(TextEditorContext)\n const enableStickyToolbar = !!features?.stickyToolbar\n const enableTabAsNavigation = !!features?.tabAsNavigation\n\n const mergedConfig = React.useMemo(() => {\n const defaultConfig = getDefaultConfig(locale)\n\n // Handle string plugins for backward compatibility\n const configWithPlugins = stringPlugins?.length\n ? addPluginsFromStringArray(defaultConfig, stringPlugins)\n : defaultConfig\n\n // Apply any external CKEditor config overrides provided by the consumer\n const externalResult =\n typeof externalConfig === 'function'\n ? externalConfig(configWithPlugins)\n : undefined\n // Merge default config (with plugins) and consumer overrides\n let finalConfig: EditorConfig = {\n ...configWithPlugins,\n ...(externalResult ?? {}),\n }\n\n return finalConfig\n }, [externalConfig, locale, stringPlugins])\n\n const bindKeyDownHandler = React.useCallback(\n (editor: ClassicEditor) => {\n if (!onKeyDown) {\n return\n }\n\n const editorElement = editor.editing.view.document.getRoot()\n if (!editorElement) {\n return\n }\n\n // Remove existing keydown listener\n if (keyDownListenerRef.current) {\n editor.editing.view.document.off('keydown', keyDownListenerRef.current)\n }\n\n // Create and store the new listener\n const keyDownListener = (\n _event: EventInfo,\n data: { domEvent: Event }\n ) => {\n const domEvent = data.domEvent as KeyboardEvent\n onKeyDown(domEvent, editor)\n }\n\n keyDownListenerRef.current = keyDownListener\n\n // Add the keydown listener\n editor.editing.view.document.on('keydown', keyDownListener)\n },\n [onKeyDown]\n )\n\n const handleChange = (\n _event: EventInfo<string, unknown>,\n editor: ClassicEditor\n ) => {\n const data = editor.getData()\n const isDirty = data !== initialValueRef.current\n\n // Call onDirty only on first content modification\n if (isDirty && !isDirtyState) {\n setIsDirtyState(true)\n onDirty?.()\n }\n\n onChange?.(data, isDirty)\n }\n\n const handleReady = (editor: ClassicEditor) => {\n addButtonDataAttributes(editor)\n editorInstanceRef.current = editor\n setIsEditorReady(true)\n\n if (initialValue) {\n editor.setData(initialValue)\n }\n\n // Bind keydown handler when editor is ready\n bindKeyDownHandler(editor)\n\n onInit?.(editor)\n }\n\n const handleBlur = (\n event: EventInfo<string, unknown>,\n editor: ClassicEditor\n ) => {\n onBlur?.(event, editor)\n }\n\n useStickyToolbar({\n enabled: enableStickyToolbar,\n editor: isEditorReady ? editorInstanceRef.current : null,\n editorRef,\n cssLoading,\n })\n\n const { config } = useTabAsNavigation({\n config: mergedConfig,\n enabled: enableTabAsNavigation,\n editor: isEditorReady ? editorInstanceRef.current : null,\n })\n\n const editorKey = `${locale}-${enableTabAsNavigation}`\n\n if (cssLoading) {\n return null\n }\n\n return (\n <StyledTextEditor ref={editorRef} key={editorKey} error={error}>\n <GlobalEditorStyles zIndex={zIndex + 1} />\n <TextEditorTheme />\n <CKEditor\n {...restProps}\n editor={ClassicEditor}\n config={config}\n disabled={disabled}\n data={value}\n onChange={handleChange}\n onReady={handleReady}\n onBlur={handleBlur}\n />\n </StyledTextEditor>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAASA,QAAQ,QAAQ,2BAA2B;AAEpD,SAASC,aAAa,QAAwB,WAAW;AACzD,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,qBAAqB;AACtE,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,kBAAkB,EAAEC,gBAAgB,QAAQ,qBAAqB;AAE1E,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,eAAe,QAAQ,qBAAqB;AACrD,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SACEC,uBAAuB,EACvBC,yBAAyB,EACzBC,gBAAgB,QACX,SAAS;;AAEhB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAAAC,IAAA,EAcN;EAAA,IAblBC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,KAAK,GAAAF,IAAA,CA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ACtD,CAAC,CAAC;IAJM/B,MAAM,GAAAuE,mBAAA,CAANvE,MAAM;EAMd,IAAMwE,SAAS,MAAAC,MAAA,CAAMrE,MAAM,OAAAqE,MAAA,CAAI9B,qBAAqB,CAAE;EAEtD,IAAIjC,UAAU,EAAE;IACd,OAAO,IAAI;EACb;EAEA,oBACElC,KAAA,CAAAkG,aAAA,CAAC7F,gBAAgB;IAAC8F,GAAG,EAAE/D,SAAU;IAACgE,GAAG,EAAEJ,SAAU;IAAChF,KAAK,EAAEA;EAAM,gBAC7DhB,KAAA,CAAAkG,aAAA,CAAC9F,kBAAkB;IAACyD,MAAM,EAAEA,MAAM,GAAG;EAAE,CAAE,CAAC,eAC1C7D,KAAA,CAAAkG,aAAA,CAAC3F,eAAe,MAAE,CAAC,eACnBP,KAAA,CAAAkG,aAAA,CAACpG,QAAQ,EAAAuG,QAAA,KACHvE,SAAS;IACbiD,MAAM,EAAEhF,aAAc;IACtByB,MAAM,EAAEA,MAAO;IACfT,QAAQ,EAAEA,QAAS;IACnBqE,IAAI,EAAEnE,KAAM;IACZE,QAAQ,EAAEoE,YAAa;IACvBe,OAAO,EAAEZ,WAAY;IACrBrE,MAAM,EAAEuE;EAAW,EACpB,CACe,CAAC;AAEvB"}
|
|
@@ -18,7 +18,7 @@ export var GlobalEditorStyles = /*#__PURE__*/createGlobalStyle([":root{--ck-z-de
|
|
|
18
18
|
});
|
|
19
19
|
export var StyledTextEditor = /*#__PURE__*/styled.div.withConfig({
|
|
20
20
|
displayName: "StyledTextEditor",
|
|
21
|
-
componentId: "text-editor-
|
|
21
|
+
componentId: "text-editor-0_0_2__sc-iim79x-0"
|
|
22
22
|
})(["", ""], function (_ref6) {
|
|
23
23
|
var error = _ref6.error;
|
|
24
24
|
return error && "\n .ck-sticky-panel__content {\n border-top-color: ".concat(colors.red50, " !important;\n border-left-color: ").concat(colors.red50, " !important;\n border-right-color: ").concat(colors.red50, " !important;\n }\n\n .ck-editor__editable {\n border-left-color: ").concat(colors.red50, " !important;\n border-right-color: ").concat(colors.red50, " !important;\n border-bottom-color: ").concat(colors.red50, " !important;\n }\n ");
|
|
@@ -111,44 +111,6 @@ export interface TextEditorProps {
|
|
|
111
111
|
* @since 12.29.0
|
|
112
112
|
*/
|
|
113
113
|
onKeyDown?: (event: KeyboardEvent, editor: ClassicEditor) => void;
|
|
114
|
-
/**
|
|
115
|
-
* If you experience problems with the new editor implementation, you can use this to **temporarily** switch back to legacy version while you report the issue.
|
|
116
|
-
*
|
|
117
|
-
* @deprecated This property will be removed in a future version. TinyMCE support has been removed.
|
|
118
|
-
* @since 10.19.0
|
|
119
|
-
*/
|
|
120
|
-
tinyMCE?: boolean;
|
|
121
|
-
/**
|
|
122
|
-
* Config for when the editor is initialized. **Changes after the editor has initialized are ignored.**
|
|
123
|
-
*
|
|
124
|
-
* @link [TinyMCE React Init](https://www.tiny.cloud/docs/integrations/react/#init)
|
|
125
|
-
* @unsupported Use at your own risk. DST makes no guarantees about this API,
|
|
126
|
-
* and is subject to removal at any point without warning or deprecation.
|
|
127
|
-
* @deprecated `init` has been deprecated and will be removed in a future version. TinyMCE support has been removed.
|
|
128
|
-
* @since 10.19.0
|
|
129
|
-
*/
|
|
130
|
-
init?: any;
|
|
131
|
-
/**
|
|
132
|
-
* Callback fired when the editor content changes
|
|
133
|
-
*
|
|
134
|
-
* @deprecated `onEditorChange` has been deprecated and will be removed in a future version. TinyMCE support has been removed. Use `onChange` instead.
|
|
135
|
-
* @since 10.19.0
|
|
136
|
-
*/
|
|
137
|
-
onEditorChange?: (value: string) => void;
|
|
138
|
-
/**
|
|
139
|
-
* Callback fired when the editor gains focus
|
|
140
|
-
*
|
|
141
|
-
* @deprecated `onFocusIn` has been deprecated and will be removed in a future version. TinyMCE support has been removed. Use `onFocus` instead.
|
|
142
|
-
* @since 10.19.0
|
|
143
|
-
*/
|
|
144
|
-
onFocusIn?: (...args: any[]) => void;
|
|
145
|
-
/**
|
|
146
|
-
* Callback fired when the editor loses focus
|
|
147
|
-
*
|
|
148
|
-
* @deprecated `onFocusOut` has been deprecated and will be removed in a future version. TinyMCE support has been removed. Use `onBlur` instead.
|
|
149
|
-
* @since 10.19.0
|
|
150
|
-
*/
|
|
151
|
-
onFocusOut?: (...args: any[]) => void;
|
|
152
114
|
}
|
|
153
115
|
export declare type KeyDownListener = (event: EventInfo, data: {
|
|
154
116
|
domEvent: Event;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditor.types.js","names":[],"sources":["../../src/TextEditor/TextEditor.types.ts"],"sourcesContent":["import type { Locale } from '@procore/core-react'\nimport type { ClassicEditor, EditorConfig, EventInfo } from 'ckeditor5'\n\nexport interface TextEditorProps {\n /**\n * Unique identifier for the editor\n *\n * @since 10.19.0\n */\n id?: string\n\n /**\n * Initial value of the editor\n *\n * @deprecated `initialValue` has been deprecated and will be removed in a future version.\n * Please use the `value` prop instead\n * @deprecatedSince 10.20.0\n * @since 10.19.0\n */\n initialValue?: string\n\n /**\n * The current value of the editor\n *\n * @since 10.19.0\n */\n value?: string\n\n /**\n * Indicates if the editor is disabled\n *\n * @since 10.19.0\n */\n disabled?: boolean\n\n /**\n * Indicates if the editor is in an error state\n *\n * @since 10.19.0\n */\n error?: boolean\n\n /**\n * Locale which will be used for localization. Can be passed directly or\n * set by wrapping components in I18n provider.\n * @since 10.19.0\n */\n locale?: Locale\n\n /**\n * Array of plugin names to add to the editor in addition to the defaults.\n * This provides backward compatibility with the deprecated TinyMCE version of the editor.\n * Supports plugin names like 'link', 'image', 'table', etc.\n *\n * @since 12.26.0\n */\n plugins?: string[]\n\n /**\n * Configuration function for customizing the editor\n *\n * @param defaultConfig - The default CKEditor configuration\n * @returns Customized configuration object\n * @since 12.26.0\n */\n config?: (defaultConfig: EditorConfig) => EditorConfig\n\n /**\n * Callback fired when the editor content changes\n *\n * @param value - The current content of the editor\n * @param isDirty - Whether the content differs from the initial value\n * @since 10.19.0\n */\n onChange?: (value: string, isDirty?: boolean) => void\n\n /**\n * Callback fired when the editor gains focus\n *\n * @since 10.19.0\n */\n onFocus?: (event: EventInfo, editor: ClassicEditor) => void\n\n /**\n * Callback fired when the editor loses focus\n *\n * @since 10.19.0\n */\n onBlur?: (event: EventInfo, editor: ClassicEditor) => void\n\n /**\n * Callback fired when an error occurs in the editor\n *\n * @since 10.19.0\n */\n onError?: (\n error: Error,\n details: {\n phase: 'initialization' | 'runtime'\n willEditorRestart?: boolean\n }\n ) => void\n\n /**\n * Callback fired when the editor is ready\n *\n * @since 10.19.0\n */\n onInit?: (editor: ClassicEditor) => void\n\n /**\n * Callback fired after the editor instance is destroyed\n *\n * @since 10.19.0\n */\n onAfterDestroy?: () => void\n\n /**\n * Callback fired when the editor becomes dirty (content differs from initial value)\n *\n * @since 12.26.0\n */\n onDirty?: () => void\n\n /**\n * Callback fired when a key is pressed in the editor\n *\n * @param event - The keyboard event\n * @param editor - The CKEditor instance\n * @since 12.29.0\n */\n onKeyDown?: (event: KeyboardEvent, editor: ClassicEditor) => void\n
|
|
1
|
+
{"version":3,"file":"TextEditor.types.js","names":[],"sources":["../../src/TextEditor/TextEditor.types.ts"],"sourcesContent":["import type { Locale } from '@procore/core-react'\nimport type { ClassicEditor, EditorConfig, EventInfo } from 'ckeditor5'\n\nexport interface TextEditorProps {\n /**\n * Unique identifier for the editor\n *\n * @since 10.19.0\n */\n id?: string\n\n /**\n * Initial value of the editor\n *\n * @deprecated `initialValue` has been deprecated and will be removed in a future version.\n * Please use the `value` prop instead\n * @deprecatedSince 10.20.0\n * @since 10.19.0\n */\n initialValue?: string\n\n /**\n * The current value of the editor\n *\n * @since 10.19.0\n */\n value?: string\n\n /**\n * Indicates if the editor is disabled\n *\n * @since 10.19.0\n */\n disabled?: boolean\n\n /**\n * Indicates if the editor is in an error state\n *\n * @since 10.19.0\n */\n error?: boolean\n\n /**\n * Locale which will be used for localization. Can be passed directly or\n * set by wrapping components in I18n provider.\n * @since 10.19.0\n */\n locale?: Locale\n\n /**\n * Array of plugin names to add to the editor in addition to the defaults.\n * This provides backward compatibility with the deprecated TinyMCE version of the editor.\n * Supports plugin names like 'link', 'image', 'table', etc.\n *\n * @since 12.26.0\n */\n plugins?: string[]\n\n /**\n * Configuration function for customizing the editor\n *\n * @param defaultConfig - The default CKEditor configuration\n * @returns Customized configuration object\n * @since 12.26.0\n */\n config?: (defaultConfig: EditorConfig) => EditorConfig\n\n /**\n * Callback fired when the editor content changes\n *\n * @param value - The current content of the editor\n * @param isDirty - Whether the content differs from the initial value\n * @since 10.19.0\n */\n onChange?: (value: string, isDirty?: boolean) => void\n\n /**\n * Callback fired when the editor gains focus\n *\n * @since 10.19.0\n */\n onFocus?: (event: EventInfo, editor: ClassicEditor) => void\n\n /**\n * Callback fired when the editor loses focus\n *\n * @since 10.19.0\n */\n onBlur?: (event: EventInfo, editor: ClassicEditor) => void\n\n /**\n * Callback fired when an error occurs in the editor\n *\n * @since 10.19.0\n */\n onError?: (\n error: Error,\n details: {\n phase: 'initialization' | 'runtime'\n willEditorRestart?: boolean\n }\n ) => void\n\n /**\n * Callback fired when the editor is ready\n *\n * @since 10.19.0\n */\n onInit?: (editor: ClassicEditor) => void\n\n /**\n * Callback fired after the editor instance is destroyed\n *\n * @since 10.19.0\n */\n onAfterDestroy?: () => void\n\n /**\n * Callback fired when the editor becomes dirty (content differs from initial value)\n *\n * @since 12.26.0\n */\n onDirty?: () => void\n\n /**\n * Callback fired when a key is pressed in the editor\n *\n * @param event - The keyboard event\n * @param editor - The CKEditor instance\n * @since 12.29.0\n */\n onKeyDown?: (event: KeyboardEvent, editor: ClassicEditor) => void\n}\n\nexport type KeyDownListener = (\n event: EventInfo,\n data: { domEvent: Event }\n) => void\n"],"mappings":""}
|
|
@@ -114,7 +114,8 @@ export var getDefaultConfig = function getDefaultConfig() {
|
|
|
114
114
|
image: {
|
|
115
115
|
insert: {
|
|
116
116
|
integrations: ['insertImageViaUrl']
|
|
117
|
-
}
|
|
117
|
+
},
|
|
118
|
+
toolbar: ['imageTextAlternative']
|
|
118
119
|
},
|
|
119
120
|
table: {
|
|
120
121
|
contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells', 'tableProperties', 'tableCellProperties'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["Alignment","AutoLink","Bold","Clipboard","Essentials","FontBackgroundColor","FontColor","FontSize","GeneralHtmlSupport","Image","ImageInsert","ImageToolbar","Indent","IndentBlock","Italic","Link","List","ListProperties","Paragraph","Strikethrough","Table","TableCaption","TableCellProperties","TableColumnResize","TableProperties","TableToolbar","Underline","CK_EDITOR_LICENSE_KEY","CutPlugin","IndentPaddingToMarginPlugin","PasteAsTextPlugin","PastePlugin","TabSpacesPlugin","getEditorTranslation","getValidEditorLocale","TEXT_COLOR_PALETTE","color","getDefaultConfig","locale","arguments","length","undefined","licenseKey","language","translations","plugins","toolbar","fontSize","options","title","model","supportAllValues","fontColor","colors","fontBackgroundColor","indentBlock","offset","unit","htmlSupport","allow","name","styles","list","properties","useAttribute","startIndex","reversed","image","insert","integrations","table","contentToolbar","tableProperties","borderColors","backgroundColors","tableCellProperties","addButtonDataAttributes","editor","applyAttributes","toolbarElement","ui","view","element","toolbarChildren","Array","from","querySelectorAll","moreDropdownButtons","allToolbarElements","concat","toolbarItems","config","get","elementIndex","forEach","itemName","classList","contains","setAttribute","observer","MutationObserver","observe","childList","subtree","on","disconnect"],"sources":["../../../src/TextEditor/utils/config.ts"],"sourcesContent":["import type { ClassicEditor, EditorConfig } from 'ckeditor5'\nimport {\n Alignment,\n AutoLink,\n Bold,\n Clipboard,\n Essentials,\n FontBackgroundColor,\n FontColor,\n FontSize,\n GeneralHtmlSupport,\n Image,\n ImageInsert,\n ImageToolbar,\n Indent,\n IndentBlock,\n Italic,\n Link,\n List,\n ListProperties,\n Paragraph,\n Strikethrough,\n Table,\n TableCaption,\n TableCellProperties,\n TableColumnResize,\n TableProperties,\n TableToolbar,\n Underline,\n} from 'ckeditor5'\n\nimport { CK_EDITOR_LICENSE_KEY } from '../license_key'\nimport { CutPlugin } from '../plugins/CutPlugin'\nimport { IndentPaddingToMarginPlugin } from '../plugins/IndentPaddingToMarginPlugin'\nimport { PasteAsTextPlugin } from '../plugins/PasteAsTextPlugin'\nimport { PastePlugin } from '../plugins/PastePlugin'\nimport { TabSpacesPlugin } from '../plugins/TabSpacesPlugin'\nimport { getEditorTranslation, getValidEditorLocale } from './locale'\n\nconst TEXT_COLOR_PALETTE = [\n { color: '#BFEDD2' },\n { color: '#FBEEB8' },\n { color: '#F8CAC6' },\n { color: '#ECCAFA' },\n { color: '#C2E0F4' },\n { color: '#2DC26B' },\n { color: '#F1C40F' },\n { color: '#E03E2D' },\n { color: '#B96AD9' },\n { color: '#3598DB' },\n { color: '#169179' },\n { color: '#E67E23' },\n { color: '#BA372A' },\n { color: '#843FA1' },\n { color: '#236FA1' },\n { color: '#ECF0F1' },\n { color: '#CED4D9' },\n { color: '#95A5A6' },\n { color: '#7E8C8D' },\n { color: '#34495E' },\n { color: '#000000' },\n { color: '#FFFFFF' },\n]\n\nexport const getDefaultConfig = (locale: string = 'en'): EditorConfig => ({\n licenseKey: CK_EDITOR_LICENSE_KEY,\n language: getValidEditorLocale(locale),\n translations: [getEditorTranslation(locale)],\n plugins: [\n Alignment,\n AutoLink,\n Bold,\n Clipboard,\n Essentials,\n FontBackgroundColor,\n FontColor,\n FontSize,\n GeneralHtmlSupport,\n Indent,\n IndentBlock,\n Italic,\n Link,\n List,\n ListProperties,\n Paragraph,\n Strikethrough,\n Table,\n TableCaption,\n TableCellProperties,\n TableColumnResize,\n TableProperties,\n TableToolbar,\n Underline,\n Image,\n ImageInsert,\n ImageToolbar,\n CutPlugin,\n PastePlugin,\n PasteAsTextPlugin,\n IndentPaddingToMarginPlugin,\n TabSpacesPlugin,\n ],\n toolbar: [\n 'bold',\n 'italic',\n 'underline',\n 'strikethrough',\n '|',\n 'alignment:left',\n 'alignment:center',\n 'alignment:right',\n '|',\n 'bulletedList',\n 'numberedList',\n '|',\n 'outdent',\n 'indent',\n '|',\n 'cut',\n 'paste',\n 'pasteAsText',\n '|',\n 'fontSize',\n '|',\n 'fontColor',\n 'fontBackgroundColor',\n '|',\n 'undo',\n 'redo',\n ],\n fontSize: {\n options: [\n { title: '8pt', model: '8px' },\n { title: '10pt', model: '10px' },\n { title: '12pt', model: '12px' },\n { title: '14pt', model: '14px' },\n { title: '18pt', model: '18px' },\n { title: '24pt', model: '24px' },\n { title: '36pt', model: '36px' },\n ],\n supportAllValues: true,\n },\n fontColor: {\n colors: TEXT_COLOR_PALETTE,\n },\n fontBackgroundColor: {\n colors: TEXT_COLOR_PALETTE,\n },\n indentBlock: {\n offset: 40,\n unit: 'px',\n },\n htmlSupport: {\n allow: [\n {\n name: 'p',\n styles: {\n 'margin-left': true,\n },\n },\n ],\n },\n list: {\n properties: {\n styles: {\n useAttribute: true,\n },\n startIndex: true,\n reversed: true,\n },\n },\n image: {\n insert: {\n integrations: ['insertImageViaUrl'],\n },\n },\n table: {\n contentToolbar: [\n 'tableColumn',\n 'tableRow',\n 'mergeTableCells',\n 'tableProperties',\n 'tableCellProperties',\n ],\n tableProperties: {\n borderColors: TEXT_COLOR_PALETTE,\n backgroundColors: TEXT_COLOR_PALETTE,\n },\n tableCellProperties: {\n borderColors: TEXT_COLOR_PALETTE,\n backgroundColors: TEXT_COLOR_PALETTE,\n },\n },\n})\n\n// Add stable data attributes to toolbar buttons for the styling (or testing) purposes\nexport const addButtonDataAttributes = (editor: ClassicEditor) => {\n const applyAttributes = () => {\n const toolbarElement = editor.ui.view.toolbar.element\n if (!toolbarElement) {\n return\n }\n\n // Get buttons in the main toolbar\n const toolbarChildren = Array.from(\n toolbarElement.querySelectorAll('.ck-toolbar__items > *')\n )\n\n // Get buttons hidden in \"more\" dropdown\n const moreDropdownButtons = Array.from(\n toolbarElement.querySelectorAll('.ck-dropdown__panel .ck-list .ck-button')\n )\n\n const allToolbarElements = [...toolbarChildren, ...moreDropdownButtons]\n\n // Create mapping based on toolbar configuration order\n const toolbarItems = (editor.config.get('toolbar') || []) as string[]\n let elementIndex = 0\n\n toolbarItems.forEach((itemName) => {\n const element = allToolbarElements[elementIndex]\n if (\n itemName !== '|' &&\n element &&\n !element.classList.contains('ck-toolbar__separator')\n ) {\n // Use the toolbar item name as the stable identifier\n element.setAttribute('data-cke-command', itemName)\n }\n elementIndex++\n })\n }\n\n // Apply attributes initially\n applyAttributes()\n\n // Re-apply when dropdown menus are opened (buttons get created dynamically)\n const toolbarElement = editor.ui.view.toolbar.element\n if (toolbarElement) {\n const observer = new MutationObserver(() => {\n applyAttributes()\n })\n observer.observe(toolbarElement, {\n childList: true,\n subtree: true,\n })\n editor.on('destroy', () => {\n observer.disconnect()\n })\n }\n}\n"],"mappings":"AACA,SACEA,SAAS,EACTC,QAAQ,EACRC,IAAI,EACJC,SAAS,EACTC,UAAU,EACVC,mBAAmB,EACnBC,SAAS,EACTC,QAAQ,EACRC,kBAAkB,EAClBC,KAAK,EACLC,WAAW,EACXC,YAAY,EACZC,MAAM,EACNC,WAAW,EACXC,MAAM,EACNC,IAAI,EACJC,IAAI,EACJC,cAAc,EACdC,SAAS,EACTC,aAAa,EACbC,KAAK,EACLC,YAAY,EACZC,mBAAmB,EACnBC,iBAAiB,EACjBC,eAAe,EACfC,YAAY,EACZC,SAAS,QACJ,WAAW;AAElB,SAASC,qBAAqB,QAAQ,gBAAgB;AACtD,SAASC,SAAS,QAAQ,sBAAsB;AAChD,SAASC,2BAA2B,QAAQ,wCAAwC;AACpF,SAASC,iBAAiB,QAAQ,8BAA8B;AAChE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,oBAAoB,EAAEC,oBAAoB,QAAQ,UAAU;AAErE,IAAMC,kBAAkB,GAAG,CACzB;EAAEC,KAAK,EAAE;AAAU,CAAC,EACpB;EAAEA,KAAK,EAAE;AAAU,CAAC,EACpB;EAAEA,KAAK,EAAE;AAAU,CAAC,EACpB;EAAEA,KAAK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AAG,CAAC,SAAS,CAAC,IAAI,EAAe;IACrE,IAAIC,YAAY,GAAG,CAAC;IAEpBH,YAAY,CAACI,OAAO,CAAC,UAACC,QAAQ,EAAK;MACjC,IAAMb,OAAO,GAAGM,kBAAkB,CAACK,YAAY,CAAC;MAChD,IACEE,QAAQ,KAAK,GAAG,IAChBb,OAAO,IACP,CAACA,OAAO,CAACc,SAAS,CAACC,QAAQ,CAAC,uBAAuB,CAAC,EACpD;QACA;QACAf,OAAO,CAACgB,YAAY,CAAC,kBAAkB,EAAEH,QAAQ,CAAC;MACpD;MACAF,YAAY,EAAE;IAChB,CAAC,CAAC;EACJ,CAAC;;EAED;EACAf,eAAe,CAAC,CAAC;;EAEjB;EACA,IAAMC,cAAc,GAAGF,MAAM,CAACG,EAAE,CAACC,IAAI,CAACnC,OAAO,CAACoC,OAAO;EACrD,IAAIH,cAAc,EAAE;IAClB,IAAMoB,QAAQ,GAAG,IAAIC,gBAAgB,CAAC,YAAM;MAC1CtB,eAAe,CAAC,CAAC;IACnB,CAAC,CAAC;IACFqB,QAAQ,CAACE,OAAO,CAACtB,cAAc,EAAE;MAC/BuB,SAAS,EAAE,IAAI;MACfC,OAAO,EAAE;IACX,CAAC,CAAC;IACF1B,MAAM,CAAC2B,EAAE,CAAC,SAAS,EAAE,YAAM;MACzBL,QAAQ,CAACM,UAAU,CAAC,CAAC;IACvB,CAAC,CAAC;EACJ;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"config.js","names":["Alignment","AutoLink","Bold","Clipboard","Essentials","FontBackgroundColor","FontColor","FontSize","GeneralHtmlSupport","Image","ImageInsert","ImageToolbar","Indent","IndentBlock","Italic","Link","List","ListProperties","Paragraph","Strikethrough","Table","TableCaption","TableCellProperties","TableColumnResize","TableProperties","TableToolbar","Underline","CK_EDITOR_LICENSE_KEY","CutPlugin","IndentPaddingToMarginPlugin","PasteAsTextPlugin","PastePlugin","TabSpacesPlugin","getEditorTranslation","getValidEditorLocale","TEXT_COLOR_PALETTE","color","getDefaultConfig","locale","arguments","length","undefined","licenseKey","language","translations","plugins","toolbar","fontSize","options","title","model","supportAllValues","fontColor","colors","fontBackgroundColor","indentBlock","offset","unit","htmlSupport","allow","name","styles","list","properties","useAttribute","startIndex","reversed","image","insert","integrations","table","contentToolbar","tableProperties","borderColors","backgroundColors","tableCellProperties","addButtonDataAttributes","editor","applyAttributes","toolbarElement","ui","view","element","toolbarChildren","Array","from","querySelectorAll","moreDropdownButtons","allToolbarElements","concat","toolbarItems","config","get","elementIndex","forEach","itemName","classList","contains","setAttribute","observer","MutationObserver","observe","childList","subtree","on","disconnect"],"sources":["../../../src/TextEditor/utils/config.ts"],"sourcesContent":["import type { ClassicEditor, EditorConfig } from 'ckeditor5'\nimport {\n Alignment,\n AutoLink,\n Bold,\n Clipboard,\n Essentials,\n FontBackgroundColor,\n FontColor,\n FontSize,\n GeneralHtmlSupport,\n Image,\n ImageInsert,\n ImageToolbar,\n Indent,\n IndentBlock,\n Italic,\n Link,\n List,\n ListProperties,\n Paragraph,\n Strikethrough,\n Table,\n TableCaption,\n TableCellProperties,\n TableColumnResize,\n TableProperties,\n TableToolbar,\n Underline,\n} from 'ckeditor5'\n\nimport { CK_EDITOR_LICENSE_KEY } from '../license_key'\nimport { CutPlugin } from '../plugins/CutPlugin'\nimport { IndentPaddingToMarginPlugin } from '../plugins/IndentPaddingToMarginPlugin'\nimport { PasteAsTextPlugin } from '../plugins/PasteAsTextPlugin'\nimport { PastePlugin } from '../plugins/PastePlugin'\nimport { TabSpacesPlugin } from '../plugins/TabSpacesPlugin'\nimport { getEditorTranslation, getValidEditorLocale } from './locale'\n\nconst TEXT_COLOR_PALETTE = [\n { color: '#BFEDD2' },\n { color: '#FBEEB8' },\n { color: '#F8CAC6' },\n { color: '#ECCAFA' },\n { color: '#C2E0F4' },\n { color: '#2DC26B' },\n { color: '#F1C40F' },\n { color: '#E03E2D' },\n { color: '#B96AD9' },\n { color: '#3598DB' },\n { color: '#169179' },\n { color: '#E67E23' },\n { color: '#BA372A' },\n { color: '#843FA1' },\n { color: '#236FA1' },\n { color: '#ECF0F1' },\n { color: '#CED4D9' },\n { color: '#95A5A6' },\n { color: '#7E8C8D' },\n { color: '#34495E' },\n { color: '#000000' },\n { color: '#FFFFFF' },\n]\n\nexport const getDefaultConfig = (locale: string = 'en'): EditorConfig => ({\n licenseKey: CK_EDITOR_LICENSE_KEY,\n language: getValidEditorLocale(locale),\n translations: [getEditorTranslation(locale)],\n plugins: [\n Alignment,\n AutoLink,\n Bold,\n Clipboard,\n Essentials,\n FontBackgroundColor,\n FontColor,\n FontSize,\n GeneralHtmlSupport,\n Indent,\n IndentBlock,\n Italic,\n Link,\n List,\n ListProperties,\n Paragraph,\n Strikethrough,\n Table,\n TableCaption,\n TableCellProperties,\n TableColumnResize,\n TableProperties,\n TableToolbar,\n Underline,\n Image,\n ImageInsert,\n ImageToolbar,\n CutPlugin,\n PastePlugin,\n PasteAsTextPlugin,\n IndentPaddingToMarginPlugin,\n TabSpacesPlugin,\n ],\n toolbar: [\n 'bold',\n 'italic',\n 'underline',\n 'strikethrough',\n '|',\n 'alignment:left',\n 'alignment:center',\n 'alignment:right',\n '|',\n 'bulletedList',\n 'numberedList',\n '|',\n 'outdent',\n 'indent',\n '|',\n 'cut',\n 'paste',\n 'pasteAsText',\n '|',\n 'fontSize',\n '|',\n 'fontColor',\n 'fontBackgroundColor',\n '|',\n 'undo',\n 'redo',\n ],\n fontSize: {\n options: [\n { title: '8pt', model: '8px' },\n { title: '10pt', model: '10px' },\n { title: '12pt', model: '12px' },\n { title: '14pt', model: '14px' },\n { title: '18pt', model: '18px' },\n { title: '24pt', model: '24px' },\n { title: '36pt', model: '36px' },\n ],\n supportAllValues: true,\n },\n fontColor: {\n colors: TEXT_COLOR_PALETTE,\n },\n fontBackgroundColor: {\n colors: TEXT_COLOR_PALETTE,\n },\n indentBlock: {\n offset: 40,\n unit: 'px',\n },\n htmlSupport: {\n allow: [\n {\n name: 'p',\n styles: {\n 'margin-left': true,\n },\n },\n ],\n },\n list: {\n properties: {\n styles: {\n useAttribute: true,\n },\n startIndex: true,\n reversed: true,\n },\n },\n image: {\n insert: {\n integrations: ['insertImageViaUrl'],\n },\n toolbar: ['imageTextAlternative'],\n },\n table: {\n contentToolbar: [\n 'tableColumn',\n 'tableRow',\n 'mergeTableCells',\n 'tableProperties',\n 'tableCellProperties',\n ],\n tableProperties: {\n borderColors: TEXT_COLOR_PALETTE,\n backgroundColors: TEXT_COLOR_PALETTE,\n },\n tableCellProperties: {\n borderColors: TEXT_COLOR_PALETTE,\n backgroundColors: TEXT_COLOR_PALETTE,\n },\n },\n})\n\n// Add stable data attributes to toolbar buttons for the styling (or testing) purposes\nexport const addButtonDataAttributes = (editor: ClassicEditor) => {\n const applyAttributes = () => {\n const toolbarElement = editor.ui.view.toolbar.element\n if (!toolbarElement) {\n return\n }\n\n // Get buttons in the main toolbar\n const toolbarChildren = Array.from(\n toolbarElement.querySelectorAll('.ck-toolbar__items > *')\n )\n\n // Get buttons hidden in \"more\" dropdown\n const moreDropdownButtons = Array.from(\n toolbarElement.querySelectorAll('.ck-dropdown__panel .ck-list .ck-button')\n )\n\n const allToolbarElements = [...toolbarChildren, ...moreDropdownButtons]\n\n // Create mapping based on toolbar configuration order\n const toolbarItems = (editor.config.get('toolbar') || []) as string[]\n let elementIndex = 0\n\n toolbarItems.forEach((itemName) => {\n const element = allToolbarElements[elementIndex]\n if (\n itemName !== '|' &&\n element &&\n !element.classList.contains('ck-toolbar__separator')\n ) {\n // Use the toolbar item name as the stable identifier\n element.setAttribute('data-cke-command', itemName)\n }\n elementIndex++\n })\n }\n\n // Apply attributes initially\n applyAttributes()\n\n // Re-apply when dropdown menus are opened (buttons get created dynamically)\n const toolbarElement = editor.ui.view.toolbar.element\n if (toolbarElement) {\n const observer = new MutationObserver(() => {\n applyAttributes()\n })\n observer.observe(toolbarElement, {\n childList: true,\n subtree: true,\n })\n editor.on('destroy', () => {\n observer.disconnect()\n })\n }\n}\n"],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ED;EACAf,eAAe,CAAC,CAAC;;EAEjB;EACA,IAAMC,cAAc,GAAGF,MAAM,CAACG,EAAE,CAACC,IAAI,CAACnC,OAAO,CAACoC,OAAO;EACrD,IAAIH,cAAc,EAAE;IAClB,IAAMoB,QAAQ,GAAG,IAAIC,gBAAgB,CAAC,YAAM;MAC1CtB,eAAe,CAAC,CAAC;IACnB,CAAC,CAAC;IACFqB,QAAQ,CAACE,OAAO,CAACtB,cAAc,EAAE;MAC/BuB,SAAS,EAAE,IAAI;MACfC,OAAO,EAAE;IACX,CAAC,CAAC;IACF1B,MAAM,CAAC2B,EAAE,CAAC,SAAS,EAAE,YAAM;MACzBL,QAAQ,CAACM,UAAU,CAAC,CAAC;IACvB,CAAC,CAAC;EACJ;AACF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
export var StyledEditor = /*#__PURE__*/styled.div.withConfig({
|
|
3
3
|
displayName: "StyledEditor",
|
|
4
|
-
componentId: "text-editor-
|
|
4
|
+
componentId: "text-editor-0_0_2__sc-1oujb2g-0"
|
|
5
5
|
})([".ck-editor__top{height:0 !important;}.ck-content{border:none !important;padding:0 !important;p{margin:0;}table,img{margin-left:auto;margin-right:auto;}img{display:block;}table{border:1px double #b3b3b3;border-collapse:collapse;border-spacing:0;th{text-align:left;}& > thead,& > tbody{& > tr > td,& > tr > th{border:1px solid #bfbfbf;min-width:2em;padding:0.4em;}& > tr > th{background:rgba(0,0,0,0.05);font-weight:700;}}}}"]);
|
|
6
6
|
//# sourceMappingURL=TextEditorOutput.styles.js.map
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"description": "Indicates if the editor is disabled",
|
|
11
11
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Indicates if the editor is disabled</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
12
12
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
13
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
13
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L34"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"name": "error",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"description": "Indicates if the editor is in an error state",
|
|
21
21
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Indicates if the editor is in an error state</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
22
22
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
23
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
23
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L41"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"name": "id",
|
|
@@ -30,18 +30,7 @@
|
|
|
30
30
|
"description": "Unique identifier for the editor",
|
|
31
31
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Unique identifier for the editor</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
32
32
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
33
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"name": "init",
|
|
37
|
-
"required": false,
|
|
38
|
-
"type": "<span class=\"tsd-signature-type\">any</span>",
|
|
39
|
-
"typeDetail": "<span class=\"tsd-signature-type\">any</span>",
|
|
40
|
-
"description": "Config for when the editor is initialized. **Changes after the editor has initialized are ignored.**",
|
|
41
|
-
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Config for when the editor is initialized. <strong>Changes after the editor has initialized are ignored.</strong></p>\n</div><dl class=\"tsd-comment-tags\"><dt>link</dt><dd><p><a href=\"https://www.tiny.cloud/docs/integrations/react/#init\">TinyMCE React Init</a></p>\n</dd><dt>unsupported</dt><dd><p>Use at your own risk. DST makes no guarantees about this API,\nand is subject to removal at any point without warning or deprecation.</p>\n</dd><dt>deprecated</dt><dd><p><code>init</code> has been deprecated and will be removed in a future version. TinyMCE support has been removed.</p>\n</dd><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
42
|
-
"deprecated": "`init` has been deprecated and will be removed in a future version. TinyMCE support has been removed.",
|
|
43
|
-
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
44
|
-
"sourceUrl": "https://github.com/procore/core/blob/d7acf0a/packages/text-editor/src/TextEditor/TextEditor.types.ts#L153"
|
|
33
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L10"
|
|
45
34
|
},
|
|
46
35
|
{
|
|
47
36
|
"name": "initialValue",
|
|
@@ -53,7 +42,7 @@
|
|
|
53
42
|
"deprecated": "`initialValue` has been deprecated and will be removed in a future version.\nPlease use the `value` prop instead",
|
|
54
43
|
"deprecatedSince": "10.20.0",
|
|
55
44
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
56
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
45
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L20"
|
|
57
46
|
},
|
|
58
47
|
{
|
|
59
48
|
"name": "locale",
|
|
@@ -63,7 +52,7 @@
|
|
|
63
52
|
"description": "Locale which will be used for localization. Can be passed directly or\nset by wrapping components in I18n provider.",
|
|
64
53
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Locale which will be used for localization. Can be passed directly or\nset by wrapping components in I18n provider.</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
65
54
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
66
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
55
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L48"
|
|
67
56
|
},
|
|
68
57
|
{
|
|
69
58
|
"name": "plugins",
|
|
@@ -73,18 +62,7 @@
|
|
|
73
62
|
"description": "Array of plugin names to add to the editor in addition to the defaults.\nThis provides backward compatibility with the deprecated TinyMCE version of the editor.\nSupports plugin names like 'link', 'image', 'table', etc.",
|
|
74
63
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Array of plugin names to add to the editor in addition to the defaults.\nThis provides backward compatibility with the deprecated TinyMCE version of the editor.\nSupports plugin names like 'link', 'image', 'table', etc.</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>12.26.0</p>\n</dd></dl></div>",
|
|
75
64
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
76
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
"name": "tinyMCE",
|
|
80
|
-
"required": false,
|
|
81
|
-
"type": "<span class=\"tsd-signature-type\">boolean</span>",
|
|
82
|
-
"typeDetail": "<span class=\"tsd-signature-type\">boolean</span>",
|
|
83
|
-
"description": "If you experience problems with the new editor implementation, you can use this to **temporarily** switch back to legacy version while you report the issue.",
|
|
84
|
-
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>If you experience problems with the new editor implementation, you can use this to <strong>temporarily</strong> switch back to legacy version while you report the issue.</p>\n</div><dl class=\"tsd-comment-tags\"><dt>deprecated</dt><dd><p>This property will be removed in a future version. TinyMCE support has been removed.</p>\n</dd><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
85
|
-
"deprecated": "This property will be removed in a future version. TinyMCE support has been removed.",
|
|
86
|
-
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
87
|
-
"sourceUrl": "https://github.com/procore/core/blob/d7acf0a/packages/text-editor/src/TextEditor/TextEditor.types.ts#L142"
|
|
65
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L57"
|
|
88
66
|
},
|
|
89
67
|
{
|
|
90
68
|
"name": "value",
|
|
@@ -94,7 +72,7 @@
|
|
|
94
72
|
"description": "The current value of the editor",
|
|
95
73
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>The current value of the editor</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
96
74
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
97
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
75
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L27"
|
|
98
76
|
},
|
|
99
77
|
{
|
|
100
78
|
"name": "config",
|
|
@@ -104,7 +82,7 @@
|
|
|
104
82
|
"description": "Configuration function for customizing the editor",
|
|
105
83
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Configuration function for customizing the editor</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>12.26.0</p>\n</dd></dl></div>",
|
|
106
84
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
107
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
85
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L66"
|
|
108
86
|
},
|
|
109
87
|
{
|
|
110
88
|
"name": "onAfterDestroy",
|
|
@@ -114,7 +92,7 @@
|
|
|
114
92
|
"description": "Callback fired after the editor instance is destroyed",
|
|
115
93
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Callback fired after the editor instance is destroyed</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
116
94
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
117
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
95
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L116"
|
|
118
96
|
},
|
|
119
97
|
{
|
|
120
98
|
"name": "onBlur",
|
|
@@ -124,7 +102,7 @@
|
|
|
124
102
|
"description": "Callback fired when the editor loses focus",
|
|
125
103
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Callback fired when the editor loses focus</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
126
104
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
127
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
105
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L89"
|
|
128
106
|
},
|
|
129
107
|
{
|
|
130
108
|
"name": "onChange",
|
|
@@ -134,7 +112,7 @@
|
|
|
134
112
|
"description": "Callback fired when the editor content changes",
|
|
135
113
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Callback fired when the editor content changes</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
136
114
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
137
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
115
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L75"
|
|
138
116
|
},
|
|
139
117
|
{
|
|
140
118
|
"name": "onDirty",
|
|
@@ -144,17 +122,7 @@
|
|
|
144
122
|
"description": "Callback fired when the editor becomes dirty (content differs from initial value)",
|
|
145
123
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Callback fired when the editor becomes dirty (content differs from initial value)</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>12.26.0</p>\n</dd></dl></div>",
|
|
146
124
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
147
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
"name": "onEditorChange",
|
|
151
|
-
"required": false,
|
|
152
|
-
"type": "Function",
|
|
153
|
-
"typeDetail": "on<wbr/>Editor<wbr/>Change<span class=\"tsd-signature-symbol\">(</span>value<span class=\"tsd-signature-symbol\">: </span><span class=\"tsd-signature-type\">string</span><span class=\"tsd-signature-symbol\">)</span><span class=\"tsd-signature-symbol\">: </span><span class=\"tsd-signature-type\">void</span>",
|
|
154
|
-
"description": "Callback fired when the editor content changes",
|
|
155
|
-
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Callback fired when the editor content changes</p>\n</div><dl class=\"tsd-comment-tags\"><dt>deprecated</dt><dd><p><code>onEditorChange</code> has been deprecated and will be removed in a future version. TinyMCE support has been removed. Use <code>onChange</code> instead.</p>\n</dd><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
156
|
-
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
157
|
-
"sourceUrl": "https://github.com/procore/core/blob/d7acf0a/packages/text-editor/src/TextEditor/TextEditor.types.ts#L161"
|
|
125
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L123"
|
|
158
126
|
},
|
|
159
127
|
{
|
|
160
128
|
"name": "onError",
|
|
@@ -164,7 +132,7 @@
|
|
|
164
132
|
"description": "Callback fired when an error occurs in the editor",
|
|
165
133
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Callback fired when an error occurs in the editor</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
166
134
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
167
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
135
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L96"
|
|
168
136
|
},
|
|
169
137
|
{
|
|
170
138
|
"name": "onFocus",
|
|
@@ -174,27 +142,7 @@
|
|
|
174
142
|
"description": "Callback fired when the editor gains focus",
|
|
175
143
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Callback fired when the editor gains focus</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
176
144
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
177
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
"name": "onFocusIn",
|
|
181
|
-
"required": false,
|
|
182
|
-
"type": "Function",
|
|
183
|
-
"typeDetail": "on<wbr/>Focus<wbr/>In<span class=\"tsd-signature-symbol\">(</span><span class=\"tsd-signature-symbol\">...</span>args<span class=\"tsd-signature-symbol\">: </span><span class=\"tsd-signature-type\">any</span><span class=\"tsd-signature-symbol\">[]</span><span class=\"tsd-signature-symbol\">)</span><span class=\"tsd-signature-symbol\">: </span><span class=\"tsd-signature-type\">void</span>",
|
|
184
|
-
"description": "Callback fired when the editor gains focus",
|
|
185
|
-
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Callback fired when the editor gains focus</p>\n</div><dl class=\"tsd-comment-tags\"><dt>deprecated</dt><dd><p><code>onFocusIn</code> has been deprecated and will be removed in a future version. TinyMCE support has been removed. Use <code>onFocus</code> instead.</p>\n</dd><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
186
|
-
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
187
|
-
"sourceUrl": "https://github.com/procore/core/blob/d7acf0a/packages/text-editor/src/TextEditor/TextEditor.types.ts#L169"
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
"name": "onFocusOut",
|
|
191
|
-
"required": false,
|
|
192
|
-
"type": "Function",
|
|
193
|
-
"typeDetail": "on<wbr/>Focus<wbr/>Out<span class=\"tsd-signature-symbol\">(</span><span class=\"tsd-signature-symbol\">...</span>args<span class=\"tsd-signature-symbol\">: </span><span class=\"tsd-signature-type\">any</span><span class=\"tsd-signature-symbol\">[]</span><span class=\"tsd-signature-symbol\">)</span><span class=\"tsd-signature-symbol\">: </span><span class=\"tsd-signature-type\">void</span>",
|
|
194
|
-
"description": "Callback fired when the editor loses focus",
|
|
195
|
-
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Callback fired when the editor loses focus</p>\n</div><dl class=\"tsd-comment-tags\"><dt>deprecated</dt><dd><p><code>onFocusOut</code> has been deprecated and will be removed in a future version. TinyMCE support has been removed. Use <code>onBlur</code> instead.</p>\n</dd><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
196
|
-
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
197
|
-
"sourceUrl": "https://github.com/procore/core/blob/d7acf0a/packages/text-editor/src/TextEditor/TextEditor.types.ts#L177"
|
|
145
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L82"
|
|
198
146
|
},
|
|
199
147
|
{
|
|
200
148
|
"name": "onInit",
|
|
@@ -204,7 +152,7 @@
|
|
|
204
152
|
"description": "Callback fired when the editor is ready",
|
|
205
153
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Callback fired when the editor is ready</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.19.0</p>\n</dd></dl></div>",
|
|
206
154
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
207
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
155
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L109"
|
|
208
156
|
},
|
|
209
157
|
{
|
|
210
158
|
"name": "onKeyDown",
|
|
@@ -214,7 +162,7 @@
|
|
|
214
162
|
"description": "Callback fired when a key is pressed in the editor",
|
|
215
163
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Callback fired when a key is pressed in the editor</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>12.29.0</p>\n</dd></dl></div>",
|
|
216
164
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
217
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
165
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditor.types.ts#L132"
|
|
218
166
|
}
|
|
219
167
|
],
|
|
220
168
|
"description": ""
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"description": "",
|
|
11
11
|
"descriptionHtml": "",
|
|
12
12
|
"sourceFile": "TextEditor/TextEditorProvider.types.ts",
|
|
13
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
13
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditorProvider.types.ts#L9"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"name": "features",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"description": "- `stickyToolbar` - Have the editor toolbar stick to the top when content is longer than the page length.\n- `tabAsNavigation` - Have `Tab` key exit the editor. Support `Alt`/`Opt` + `Tab` as triple space indent.",
|
|
21
21
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<ul>\n<li><code>stickyToolbar</code> - Have the editor toolbar stick to the top when content is longer than the page length.</li>\n<li><code>tabAsNavigation</code> - Have <code>Tab</code> key exit the editor. Support <code>Alt</code>/<code>Opt</code> + <code>Tab</code> as triple space indent.</li>\n</ul>\n</div></div>",
|
|
22
22
|
"sourceFile": "TextEditor/TextEditorProvider.types.ts",
|
|
23
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
23
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditor/TextEditorProvider.types.ts#L14"
|
|
24
24
|
}
|
|
25
25
|
],
|
|
26
26
|
"description": ""
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"description": "Additional classNames",
|
|
11
11
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Additional classNames</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.24.0</p>\n</dd></dl></div>",
|
|
12
12
|
"sourceFile": "TextEditorOutput/TextEditorOutput.types.ts",
|
|
13
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
13
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditorOutput/TextEditorOutput.types.ts#L14"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
"name": "style",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"description": "Additional CSS styles",
|
|
21
21
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Additional CSS styles</p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.24.0</p>\n</dd></dl></div>",
|
|
22
22
|
"sourceFile": "TextEditorOutput/TextEditorOutput.types.ts",
|
|
23
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
23
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditorOutput/TextEditorOutput.types.ts#L21"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"name": "value",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"description": "Formatted text from `TextEditor`",
|
|
31
31
|
"descriptionHtml": "<div class=\"tsd-comment tsd-typography\"><div class=\"lead\">\n<p>Formatted text from <code>TextEditor</code></p>\n</div><dl class=\"tsd-comment-tags\"><dt>since</dt><dd><p>10.24.0</p>\n</dd></dl></div>",
|
|
32
32
|
"sourceFile": "TextEditorOutput/TextEditorOutput.types.ts",
|
|
33
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
33
|
+
"sourceUrl": "https://github.com/procore/core/blob/a0e44d5/packages/text-editor/src/TextEditorOutput/TextEditorOutput.types.ts#L7"
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
36
|
"description": ""
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"interface":"TextEditorProps","property":"
|
|
1
|
+
[{"interface":"TextEditorProps","property":"initialValue","deprecatedSince":"10.20.0","message":"`initialValue` has been deprecated and will be removed in a future version.\nPlease use the `value` prop instead","deprecationKind":"prop"}]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@procore/text-editor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Rich text editor component based on CKEditor 5",
|
|
5
5
|
"author": "Procore Technologies",
|
|
6
6
|
"homepage": "https://github.com/procore/core/tree/main/packages/text-editor",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"test:watch": "yarn run test --watch"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@procore/core-react": "^12.
|
|
70
|
+
"@procore/core-react": "^12.32.0",
|
|
71
71
|
"@procore/globalization-toolkit": ">= 3 < 4",
|
|
72
72
|
"ckeditor5": "^46.0.1",
|
|
73
73
|
"react": ">=16.8.0 < 19",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@ckeditor/ckeditor5-react": "^11.0.0",
|
|
79
|
-
"@procore/core-i18n-js": "^10.
|
|
80
|
-
"@procore/core-icons": "^12.
|
|
79
|
+
"@procore/core-i18n-js": "^10.30.0",
|
|
80
|
+
"@procore/core-icons": "^12.11.0",
|
|
81
81
|
"@react-aria/focus": "3.16.2",
|
|
82
82
|
"@react-aria/utils": "3.23.2",
|
|
83
83
|
"sanitize-html": "^2.17.0"
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"@babel/register": "7.18.9",
|
|
94
94
|
"@ckeditor/ckeditor5-dev-utils": "^43.1.0",
|
|
95
95
|
"@ckeditor/ckeditor5-dev-webpack-plugin": "^31.1.13",
|
|
96
|
-
"@procore/core-react": "^12.
|
|
96
|
+
"@procore/core-react": "^12.32.0",
|
|
97
97
|
"@procore/globalization-toolkit": "3.0.0",
|
|
98
98
|
"@procore/storybook-addon": "^4.0.0",
|
|
99
99
|
"@storybook/addon-docs": "^7.5.3",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/{src/TextEditor → TextEditor}/plugins/PasteAsTextPlugin/PasteAsTextCommand.d.ts
RENAMED
|
File without changes
|
/package/dist/{src/TextEditor → TextEditor}/plugins/PasteAsTextPlugin/PasteAsTextPlugin.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|