@procore/text-editor 0.0.2 → 0.0.3
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/CHANGELOG.md +19 -0
- package/codemod/__fixtures__/procore.config.ternary.js +18 -0
- package/codemod/text-editor-migrate.js +259 -105
- package/codemod/text-editor-migrate.test.js +19 -0
- package/dist/TextEditor/TextEditor.styles.js +1 -1
- package/dist/TextEditor/TextEditorProvider.js +1 -1
- package/dist/TextEditor/TextEditorProvider.js.map +1 -1
- package/dist/TextEditor/plugins/TabSpacesPlugin/TabSpacesPlugin.js +2 -0
- package/dist/TextEditor/plugins/TabSpacesPlugin/TabSpacesPlugin.js.map +1 -1
- package/dist/TextEditor/useTabAsNavigation.js +2 -1
- package/dist/TextEditor/useTabAsNavigation.js.map +1 -1
- package/dist/TextEditor/utils/config.js +3 -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 -16
- package/dist/_typedoc/TextEditor/TextEditorProvider.types.json +2 -2
- package/dist/_typedoc/TextEditorOutput/TextEditorOutput.types.json +3 -3
- package/package.json +10 -14
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @procore/text-editor
|
|
2
|
+
|
|
3
|
+
## 0.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4656bce: Default provider TAB key as navigation to remove keyboard trap
|
|
8
|
+
|
|
9
|
+
## 0.0.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 7d01b54: Fix some types and remove legacy tinymce no-ops and focus.
|
|
14
|
+
|
|
15
|
+
## 0.0.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- f95beb2: Initial release of a separate TextEditor package, extracted from core-react.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const { coreReactJestConfig } = require('@procore/core-react/jestConfig')
|
|
2
|
+
|
|
3
|
+
module.exports = ({ env }) => ({
|
|
4
|
+
app: {
|
|
5
|
+
webpackOverride(config) {
|
|
6
|
+
return config
|
|
7
|
+
},
|
|
8
|
+
moduleFederation: {
|
|
9
|
+
shared:
|
|
10
|
+
process.env.NODE_ENV === 'production'
|
|
11
|
+
? { react: deps.react, 'react-dom': deps['react-dom'] }
|
|
12
|
+
: {},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
jestOverride: (defaultConfig) => {
|
|
16
|
+
return coreReactJestConfig(defaultConfig)
|
|
17
|
+
},
|
|
18
|
+
})
|
|
@@ -289,9 +289,255 @@ function transformFormRichText(fileContent) {
|
|
|
289
289
|
return { content: newContent, modified }
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
+
/**
|
|
293
|
+
* Add ckeditor5 singleton configuration to a shared object
|
|
294
|
+
* Returns the modified content and whether it was modified
|
|
295
|
+
*/
|
|
296
|
+
function addSingletonToSharedObject(content, sharedMatch) {
|
|
297
|
+
const insertPosition = sharedMatch.index + sharedMatch[0].length
|
|
298
|
+
|
|
299
|
+
// Detect indentation by looking at the content after `shared: {` or similar
|
|
300
|
+
// Find the first property inside shared to determine proper indentation
|
|
301
|
+
const afterShared = content.substring(insertPosition)
|
|
302
|
+
const firstPropertyMatch = afterShared.match(/\n(\s+)\w+\s*:/)
|
|
303
|
+
|
|
304
|
+
let propertyIndent = ''
|
|
305
|
+
let indentUnit = ' ' // default to 2 spaces
|
|
306
|
+
|
|
307
|
+
if (firstPropertyMatch) {
|
|
308
|
+
// Use the same indentation as the first property inside shared
|
|
309
|
+
propertyIndent = firstPropertyMatch[1]
|
|
310
|
+
// Detect indent unit from the property indent
|
|
311
|
+
const sharedLineMatch = content
|
|
312
|
+
.substring(0, sharedMatch.index)
|
|
313
|
+
.match(/\n(\s+)(?:shared|\?)/)
|
|
314
|
+
if (sharedLineMatch) {
|
|
315
|
+
const sharedIndent = sharedLineMatch[1]
|
|
316
|
+
// indentUnit is the difference between property indent and shared indent
|
|
317
|
+
if (propertyIndent.length > sharedIndent.length) {
|
|
318
|
+
indentUnit = propertyIndent.substring(sharedIndent.length)
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
} else {
|
|
322
|
+
// Fallback: detect from the 'shared' line indentation
|
|
323
|
+
const beforeMatch = content.substring(0, sharedMatch.index)
|
|
324
|
+
const lastNewlineIndex = beforeMatch.lastIndexOf('\n')
|
|
325
|
+
const lineStart =
|
|
326
|
+
lastNewlineIndex >= 0
|
|
327
|
+
? beforeMatch.substring(lastNewlineIndex + 1)
|
|
328
|
+
: beforeMatch
|
|
329
|
+
const baseIndentMatch = lineStart.match(/^(\s*)/)
|
|
330
|
+
const baseIndent = baseIndentMatch ? baseIndentMatch[1] : ''
|
|
331
|
+
|
|
332
|
+
// Determine if we're using tabs or spaces
|
|
333
|
+
const useTabs = baseIndent.includes('\t')
|
|
334
|
+
indentUnit = useTabs ? '\t' : ' '
|
|
335
|
+
propertyIndent = baseIndent + indentUnit
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// Build the ckeditor5 configuration
|
|
339
|
+
const ckeditor5Config = `
|
|
340
|
+
${propertyIndent}ckeditor5: {
|
|
341
|
+
${propertyIndent}${indentUnit}requiredVersion: deps['ckeditor5'],
|
|
342
|
+
${propertyIndent}${indentUnit}singleton: true,
|
|
343
|
+
${propertyIndent}},`
|
|
344
|
+
|
|
345
|
+
// Insert the ckeditor5 configuration after the opening brace
|
|
346
|
+
return (
|
|
347
|
+
content.substring(0, insertPosition) +
|
|
348
|
+
ckeditor5Config +
|
|
349
|
+
content.substring(insertPosition)
|
|
350
|
+
)
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Add deps import/require statement to the file if not already present
|
|
355
|
+
*/
|
|
356
|
+
function addDepsImport(content, filePath) {
|
|
357
|
+
// Check if deps variable is already declared
|
|
358
|
+
if (
|
|
359
|
+
content.includes("require('./package.json')") ||
|
|
360
|
+
content.includes("require('./package.json').dependencies") ||
|
|
361
|
+
content.includes("from './package.json'")
|
|
362
|
+
) {
|
|
363
|
+
return content
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// Determine if using CommonJS or ES modules
|
|
367
|
+
const isESModule =
|
|
368
|
+
content.includes('export default') ||
|
|
369
|
+
content.includes('export {') ||
|
|
370
|
+
filePath.endsWith('.mjs')
|
|
371
|
+
|
|
372
|
+
if (isESModule) {
|
|
373
|
+
// For ES modules, add import at the top
|
|
374
|
+
const importStatement =
|
|
375
|
+
"import deps from './package.json' with { type: 'json' }\n"
|
|
376
|
+
|
|
377
|
+
// Find the first import or export statement
|
|
378
|
+
const firstImportMatch = content.match(/^(import|export)/m)
|
|
379
|
+
if (firstImportMatch) {
|
|
380
|
+
const insertPos = content.indexOf(firstImportMatch[0])
|
|
381
|
+
return (
|
|
382
|
+
content.substring(0, insertPos) +
|
|
383
|
+
importStatement +
|
|
384
|
+
content.substring(insertPos)
|
|
385
|
+
)
|
|
386
|
+
} else {
|
|
387
|
+
return importStatement + content
|
|
388
|
+
}
|
|
389
|
+
} else {
|
|
390
|
+
// For CommonJS, add require at the top
|
|
391
|
+
const requireStatement =
|
|
392
|
+
"const deps = require('./package.json').dependencies\n"
|
|
393
|
+
|
|
394
|
+
// Find the first require or const statement
|
|
395
|
+
const firstRequireMatch = content.match(/^(const|let|var|require)/m)
|
|
396
|
+
if (firstRequireMatch) {
|
|
397
|
+
const insertPos = content.indexOf(firstRequireMatch[0])
|
|
398
|
+
return (
|
|
399
|
+
content.substring(0, insertPos) +
|
|
400
|
+
requireStatement +
|
|
401
|
+
content.substring(insertPos)
|
|
402
|
+
)
|
|
403
|
+
} else {
|
|
404
|
+
return requireStatement + content
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Find the matching closing brace for an opening brace at the given position
|
|
411
|
+
*/
|
|
412
|
+
function findMatchingBrace(content, openBracePos) {
|
|
413
|
+
let depth = 1
|
|
414
|
+
let pos = openBracePos + 1
|
|
415
|
+
|
|
416
|
+
while (pos < content.length && depth > 0) {
|
|
417
|
+
const char = content[pos]
|
|
418
|
+
if (char === '{') {
|
|
419
|
+
depth++
|
|
420
|
+
} else if (char === '}') {
|
|
421
|
+
depth--
|
|
422
|
+
}
|
|
423
|
+
pos++
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
return depth === 0 ? pos - 1 : -1
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* Check if an object block contains a 'react' key
|
|
431
|
+
*/
|
|
432
|
+
function objectContainsReact(content, openBracePos) {
|
|
433
|
+
const closeBracePos = findMatchingBrace(content, openBracePos)
|
|
434
|
+
if (closeBracePos === -1) return false
|
|
435
|
+
|
|
436
|
+
const objectContent = content.substring(openBracePos, closeBracePos + 1)
|
|
437
|
+
// Check for react as a key (handles react:, 'react':, "react":)
|
|
438
|
+
return /(?:^|[{,\s])react\s*:|['"]react['"]\s*:/.test(objectContent)
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Transform module federation with ternary conditional pattern
|
|
443
|
+
* Handles patterns like:
|
|
444
|
+
* shared: process.env.NODE_ENV === 'production'
|
|
445
|
+
* ? { react: deps.react, 'react-dom': deps['react-dom'] }
|
|
446
|
+
* : {},
|
|
447
|
+
* Only adds ckeditor5 to branches that contain 'react'
|
|
448
|
+
*/
|
|
449
|
+
function transformModuleFederationTernary(fileContent, filePath) {
|
|
450
|
+
let newContent = fileContent
|
|
451
|
+
|
|
452
|
+
// Pattern to match ternary conditional for shared - find the opening brace of the consequent
|
|
453
|
+
// Matches: shared: <condition> ? {
|
|
454
|
+
const ternaryRegex =
|
|
455
|
+
/shared\s*:\s*[\w.]+\s*===?\s*['"][^'"]+['"]\s*\?\s*(\{)/g
|
|
456
|
+
|
|
457
|
+
let match
|
|
458
|
+
let offset = 0
|
|
459
|
+
|
|
460
|
+
// Find all ternary patterns and process the consequent (true branch)
|
|
461
|
+
while ((match = ternaryRegex.exec(fileContent)) !== null) {
|
|
462
|
+
const adjustedIndex = match.index + offset
|
|
463
|
+
const bracePos = adjustedIndex + match[0].length - 1 // Position of the opening brace
|
|
464
|
+
|
|
465
|
+
// Only add ckeditor5 if this branch contains 'react'
|
|
466
|
+
if (!objectContainsReact(newContent, bracePos)) {
|
|
467
|
+
continue
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
const adjustedMatch = {
|
|
471
|
+
...match,
|
|
472
|
+
index: bracePos,
|
|
473
|
+
0: '{',
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
const beforeLength = newContent.length
|
|
477
|
+
newContent = addSingletonToSharedObject(newContent, adjustedMatch)
|
|
478
|
+
offset += newContent.length - beforeLength
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
// Now find and process the alternate (false branch) - the : { ... } part
|
|
482
|
+
// We need to find the consequent's closing brace first, then find the alternate
|
|
483
|
+
const ternaryRegex2 = /shared\s*:\s*[\w.]+\s*===?\s*['"][^'"]+['"]\s*\?\s*\{/g
|
|
484
|
+
|
|
485
|
+
let match2
|
|
486
|
+
while ((match2 = ternaryRegex2.exec(newContent)) !== null) {
|
|
487
|
+
// Find the opening brace of the consequent
|
|
488
|
+
const consequentOpenBrace = match2.index + match2[0].length - 1
|
|
489
|
+
|
|
490
|
+
// Find the matching closing brace
|
|
491
|
+
const consequentCloseBrace = findMatchingBrace(
|
|
492
|
+
newContent,
|
|
493
|
+
consequentOpenBrace
|
|
494
|
+
)
|
|
495
|
+
|
|
496
|
+
if (consequentCloseBrace === -1) continue
|
|
497
|
+
|
|
498
|
+
// Find the alternate branch - look for : { after the closing brace
|
|
499
|
+
const afterConsequent = newContent.substring(consequentCloseBrace + 1)
|
|
500
|
+
const alternateMatch = afterConsequent.match(/^\s*:\s*(\{)/)
|
|
501
|
+
|
|
502
|
+
if (alternateMatch) {
|
|
503
|
+
const alternateBracePos =
|
|
504
|
+
consequentCloseBrace +
|
|
505
|
+
1 +
|
|
506
|
+
alternateMatch.index +
|
|
507
|
+
alternateMatch[0].length -
|
|
508
|
+
1
|
|
509
|
+
|
|
510
|
+
// Only add ckeditor5 if this branch contains 'react'
|
|
511
|
+
if (!objectContainsReact(newContent, alternateBracePos)) {
|
|
512
|
+
continue
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
const adjustedMatch = {
|
|
516
|
+
index: alternateBracePos,
|
|
517
|
+
0: '{',
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
newContent = addSingletonToSharedObject(newContent, adjustedMatch)
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// Add deps import if needed only if we made changes
|
|
525
|
+
if (newContent !== fileContent) {
|
|
526
|
+
newContent = addDepsImport(newContent, filePath)
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
const modified = newContent !== fileContent
|
|
530
|
+
if (modified) {
|
|
531
|
+
stats.moduleFederationUpdated++
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
return { content: newContent, modified }
|
|
535
|
+
}
|
|
536
|
+
|
|
292
537
|
/**
|
|
293
538
|
* Transform module federation configuration to add ckeditor5 singleton
|
|
294
539
|
* Handles both hammer.config.* and procore.config.* files
|
|
540
|
+
* Supports both direct object pattern and ternary conditional pattern
|
|
295
541
|
*/
|
|
296
542
|
function transformModuleFederation(fileContent, filePath) {
|
|
297
543
|
let modified = false
|
|
@@ -321,6 +567,12 @@ function transformModuleFederation(fileContent, filePath) {
|
|
|
321
567
|
return { content: newContent, modified }
|
|
322
568
|
}
|
|
323
569
|
|
|
570
|
+
// Check if this is a ternary conditional pattern
|
|
571
|
+
const ternaryPattern = /shared\s*:\s*[\w.]+\s*===?\s*['"][^'"]+['"]\s*\?/
|
|
572
|
+
if (ternaryPattern.test(newContent)) {
|
|
573
|
+
return transformModuleFederationTernary(newContent, filePath)
|
|
574
|
+
}
|
|
575
|
+
|
|
324
576
|
// Pattern to match shared object in moduleFederation
|
|
325
577
|
// Handles both `shared: {` and `shared:{` patterns
|
|
326
578
|
const sharedObjectRegex = /(shared\s*:\s*\{)/g
|
|
@@ -332,109 +584,8 @@ function transformModuleFederation(fileContent, filePath) {
|
|
|
332
584
|
// Find the match and its position
|
|
333
585
|
const match = sharedObjectRegex.exec(newContent)
|
|
334
586
|
if (match) {
|
|
335
|
-
|
|
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
|
-
}
|
|
587
|
+
newContent = addSingletonToSharedObject(newContent, match)
|
|
588
|
+
newContent = addDepsImport(newContent, filePath)
|
|
438
589
|
|
|
439
590
|
modified = true
|
|
440
591
|
stats.moduleFederationUpdated++
|
|
@@ -505,7 +656,8 @@ function processFile(filePath) {
|
|
|
505
656
|
// Config file detection
|
|
506
657
|
const isConfigFile =
|
|
507
658
|
/^jest\.(config|setup)\.(js|ts|cjs|mjs)$/.test(fileName) ||
|
|
508
|
-
/\.config\.(js|ts|cjs|mjs)$/.test(fileName)
|
|
659
|
+
/\.config\.(js|ts|cjs|mjs)$/.test(fileName) ||
|
|
660
|
+
/\.config\..*\.(js|ts|cjs|mjs)$/.test(fileName) // Last one for tests like "procore.config.ternay.js"
|
|
509
661
|
|
|
510
662
|
// Process Jest configuration
|
|
511
663
|
if (isConfigFile && content.includes('coreReactJestConfig')) {
|
|
@@ -721,7 +873,9 @@ ${colors.bold}Examples:${colors.reset}
|
|
|
721
873
|
|
|
722
874
|
if (stats.filesProcessed > 0) {
|
|
723
875
|
console.log(`${colors.bold}Next steps:${colors.reset}\n`)
|
|
724
|
-
console.log(
|
|
876
|
+
console.log(
|
|
877
|
+
'1. Review the changes made by the codemod. May need to be linted.\n'
|
|
878
|
+
)
|
|
725
879
|
console.log(
|
|
726
880
|
'2. Review previous implementation for additional props and migrate to CKEditor, https://ckeditor.com/docs/ckeditor5/latest/features/index.html\n'
|
|
727
881
|
)
|
|
@@ -209,6 +209,25 @@ describe('text-editor-migrate codemod', () => {
|
|
|
209
209
|
expect(matches).toHaveLength(1)
|
|
210
210
|
})
|
|
211
211
|
|
|
212
|
+
it('should add ckeditor5 only to ternary branches that contain react', () => {
|
|
213
|
+
execFileSync('node', [codemodPath, testDir], { stdio: 'ignore' })
|
|
214
|
+
|
|
215
|
+
const content = readFile('procore.config.ternary.js')
|
|
216
|
+
|
|
217
|
+
// Should have ckeditor5 only in the branch with react (production branch)
|
|
218
|
+
const ckeditor5Matches = content.match(/ckeditor5:/g)
|
|
219
|
+
expect(ckeditor5Matches).toHaveLength(1)
|
|
220
|
+
|
|
221
|
+
// Should have deps import
|
|
222
|
+
expect(content).toContain(
|
|
223
|
+
"const deps = require('./package.json').dependencies"
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
// Should have singleton: true only once
|
|
227
|
+
const singletonMatches = content.match(/singleton:\s*true/g)
|
|
228
|
+
expect(singletonMatches).toHaveLength(1)
|
|
229
|
+
})
|
|
230
|
+
|
|
212
231
|
it('should not modify config files without moduleFederation.shared', () => {
|
|
213
232
|
// Create a config file without moduleFederation
|
|
214
233
|
const noModFedConfig = `
|
|
@@ -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_3__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 ");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextEditorProvider.js","names":["React","TextEditorContext","createContext","features","tabAsNavigation","
|
|
1
|
+
{"version":3,"file":"TextEditorProvider.js","names":["React","TextEditorContext","createContext","features","tabAsNavigation","stickyToolbar","undefined","TextEditorProvider","_ref","children","createElement","Provider","value"],"sources":["../../src/TextEditor/TextEditorProvider.tsx"],"sourcesContent":["import React from 'react'\nimport type { TextEditorProviderProps } from './TextEditorProvider.types'\n\nexport const TextEditorContext = React.createContext<\n Omit<TextEditorProviderProps, 'children'>\n>({\n features: {\n tabAsNavigation: true,\n stickyToolbar: undefined,\n },\n})\n\nexport function TextEditorProvider({\n children,\n features,\n}: TextEditorProviderProps) {\n return (\n <TextEditorContext.Provider value={{ features }}>\n {children}\n </TextEditorContext.Provider>\n )\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,OAAO,IAAMC,iBAAiB,gBAAGD,KAAK,CAACE,aAAa,CAElD;EACAC,QAAQ,EAAE;IACRC,eAAe,EAAE,IAAI;IACrBC,aAAa,EAAEC;EACjB;AACF,CAAC,CAAC;AAEF,OAAO,SAASC,kBAAkBA,CAAAC,IAAA,EAGN;EAAA,IAF1BC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRN,QAAQ,GAAAK,IAAA,CAARL,QAAQ;EAER,oBACEH,KAAA,CAAAU,aAAA,CAACT,iBAAiB,CAACU,QAAQ;IAACC,KAAK,EAAE;MAAET,QAAQ,EAARA;IAAS;EAAE,GAC7CM,QACyB,CAAC;AAEjC"}
|
|
@@ -12,6 +12,8 @@ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? O
|
|
|
12
12
|
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
13
13
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
14
14
|
import { Plugin, toWidget, viewToModelPositionOutsideModelElement, Widget } from 'ckeditor5';
|
|
15
|
+
|
|
16
|
+
// TODO - delete
|
|
15
17
|
export var TabSpacesPlugin = /*#__PURE__*/function (_Plugin) {
|
|
16
18
|
function TabSpacesPlugin() {
|
|
17
19
|
_classCallCheck(this, TabSpacesPlugin);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabSpacesPlugin.js","names":["Plugin","toWidget","viewToModelPositionOutsideModelElement","Widget","TabSpacesPlugin","_Plugin","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","init","editor","model","doc","document","schema","register","allowWhere","isInline","isObject","editing","mapper","on","viewElement","hasClass","conversion","elementToElement","view","modelItem","_ref","viewWriter","writer","span","createContainerElement","contenteditable","insert","createPositionAt","createText","label","_ref2","name","classes","keystrokes","set","evtData","cancel","change","tab","createElement","insertContent","selection","get"],"sources":["../../../../src/TextEditor/plugins/TabSpacesPlugin/TabSpacesPlugin.ts"],"sourcesContent":["import type { Editor } from 'ckeditor5'\nimport {\n Plugin,\n toWidget,\n viewToModelPositionOutsideModelElement,\n Widget,\n} from 'ckeditor5'\n\nexport class TabSpacesPlugin extends Plugin {\n static get requires() {\n return [Widget]\n }\n\n static get pluginName() {\n return 'TabSpacesPlugin'\n }\n\n init(): void {\n const editor = this.editor as Editor\n const model = editor.model\n const doc = model.document\n\n model.schema.register('tab', {\n allowWhere: '$text',\n isInline: true,\n isObject: true,\n })\n\n editor.editing.mapper.on(\n 'viewToModelPosition',\n viewToModelPositionOutsideModelElement(model, (viewElement) =>\n viewElement.hasClass('ck-tab')\n )\n )\n\n editor.conversion.for('editingDowncast').elementToElement({\n model: 'tab',\n view: (modelItem, { writer: viewWriter }) => {\n const span = viewWriter.createContainerElement('span', {\n class: 'ck-tab',\n contenteditable: 'false',\n })\n viewWriter.insert(\n viewWriter.createPositionAt(span, 0),\n viewWriter.createText('\\u00A0\\u00A0\\u00A0')\n )\n\n return toWidget(span, viewWriter, { label: 'tab spaces' })\n },\n })\n\n editor.conversion.for('dataDowncast').elementToElement({\n model: 'tab',\n view: (modelItem, { writer: viewWriter }) => {\n const span = viewWriter.createContainerElement('span', {\n class: 'ck-tab',\n })\n viewWriter.insert(\n viewWriter.createPositionAt(span, 0),\n viewWriter.createText('\\u00A0\\u00A0\\u00A0')\n )\n return span\n },\n })\n\n editor.conversion.for('upcast').elementToElement({\n view: {\n name: 'span',\n classes: 'ck-tab',\n },\n model: 'tab',\n })\n\n editor.keystrokes.set('Tab', (evtData, cancel) => {\n model.change((writer) => {\n const tab = writer.createElement('tab')\n model.insertContent(tab, doc.selection)\n })\n cancel()\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,SACEA,MAAM,EACNC,QAAQ,EACRC,sCAAsC,EACtCC,MAAM,QACD,WAAW;
|
|
1
|
+
{"version":3,"file":"TabSpacesPlugin.js","names":["Plugin","toWidget","viewToModelPositionOutsideModelElement","Widget","TabSpacesPlugin","_Plugin","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","value","init","editor","model","doc","document","schema","register","allowWhere","isInline","isObject","editing","mapper","on","viewElement","hasClass","conversion","elementToElement","view","modelItem","_ref","viewWriter","writer","span","createContainerElement","contenteditable","insert","createPositionAt","createText","label","_ref2","name","classes","keystrokes","set","evtData","cancel","change","tab","createElement","insertContent","selection","get"],"sources":["../../../../src/TextEditor/plugins/TabSpacesPlugin/TabSpacesPlugin.ts"],"sourcesContent":["import type { Editor } from 'ckeditor5'\nimport {\n Plugin,\n toWidget,\n viewToModelPositionOutsideModelElement,\n Widget,\n} from 'ckeditor5'\n\n// TODO - delete\nexport class TabSpacesPlugin extends Plugin {\n static get requires() {\n return [Widget]\n }\n\n static get pluginName() {\n return 'TabSpacesPlugin'\n }\n\n init(): void {\n const editor = this.editor as Editor\n const model = editor.model\n const doc = model.document\n\n model.schema.register('tab', {\n allowWhere: '$text',\n isInline: true,\n isObject: true,\n })\n\n editor.editing.mapper.on(\n 'viewToModelPosition',\n viewToModelPositionOutsideModelElement(model, (viewElement) =>\n viewElement.hasClass('ck-tab')\n )\n )\n\n editor.conversion.for('editingDowncast').elementToElement({\n model: 'tab',\n view: (modelItem, { writer: viewWriter }) => {\n const span = viewWriter.createContainerElement('span', {\n class: 'ck-tab',\n contenteditable: 'false',\n })\n viewWriter.insert(\n viewWriter.createPositionAt(span, 0),\n viewWriter.createText('\\u00A0\\u00A0\\u00A0')\n )\n\n return toWidget(span, viewWriter, { label: 'tab spaces' })\n },\n })\n\n editor.conversion.for('dataDowncast').elementToElement({\n model: 'tab',\n view: (modelItem, { writer: viewWriter }) => {\n const span = viewWriter.createContainerElement('span', {\n class: 'ck-tab',\n })\n viewWriter.insert(\n viewWriter.createPositionAt(span, 0),\n viewWriter.createText('\\u00A0\\u00A0\\u00A0')\n )\n return span\n },\n })\n\n editor.conversion.for('upcast').elementToElement({\n view: {\n name: 'span',\n classes: 'ck-tab',\n },\n model: 'tab',\n })\n\n editor.keystrokes.set('Tab', (evtData, cancel) => {\n model.change((writer) => {\n const tab = writer.createElement('tab')\n model.insertContent(tab, doc.selection)\n })\n cancel()\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA,SACEA,MAAM,EACNC,QAAQ,EACRC,sCAAsC,E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AAA2C,GAAA,EAED,SAAAA,IAAA,EAAwB;MACtB,OAAO,iBAAiB;IAC1B;EAAC;AAAA,EAPkCtD,MAAM"}
|
|
@@ -5,6 +5,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import React from 'react';
|
|
8
|
+
// TODO - delete
|
|
8
9
|
export var useTabAsNavigation = function useTabAsNavigation(_ref) {
|
|
9
10
|
var enabled = _ref.enabled,
|
|
10
11
|
config = _ref.config,
|
|
@@ -16,7 +17,7 @@ export var useTabAsNavigation = function useTabAsNavigation(_ref) {
|
|
|
16
17
|
|
|
17
18
|
// Remove TabSpacesPlugin when tabAsNavigation is enabled
|
|
18
19
|
var filteredPlugins = config.plugins.filter(function (plugin) {
|
|
19
|
-
return typeof plugin === 'string' ? plugin !== 'TabSpacesPlugin' : plugin.pluginName !== 'TabSpacesPlugin';
|
|
20
|
+
return typeof plugin === 'string' ? plugin !== 'TabSpacesPlugin' : (plugin === null || plugin === void 0 ? void 0 : plugin.pluginName) !== 'TabSpacesPlugin';
|
|
20
21
|
});
|
|
21
22
|
return _objectSpread(_objectSpread({}, config), {}, {
|
|
22
23
|
plugins: filteredPlugins
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTabAsNavigation.js","names":["React","useTabAsNavigation","_ref","enabled","config","editor","enhancedConfig","useMemo","plugins","filteredPlugins","filter","plugin","pluginName","_objectSpread"],"sources":["../../src/TextEditor/useTabAsNavigation.ts"],"sourcesContent":["import type { ClassicEditor, EditorConfig } from 'ckeditor5'\nimport React from 'react'\n\ninterface UseTabAsNavigationProps {\n enabled: boolean\n config: EditorConfig\n editor: ClassicEditor | null\n}\n\ninterface UseTabAsNavigationReturn {\n config: EditorConfig\n}\n\nexport const useTabAsNavigation = ({\n enabled,\n config,\n editor,\n}: UseTabAsNavigationProps): UseTabAsNavigationReturn => {\n const enhancedConfig = React.useMemo(() => {\n if (!enabled || !config.plugins) {\n return config\n }\n\n // Remove TabSpacesPlugin when tabAsNavigation is enabled\n const filteredPlugins = config.plugins.filter((plugin) => {\n return typeof plugin === 'string'\n ? plugin !== 'TabSpacesPlugin'\n : plugin
|
|
1
|
+
{"version":3,"file":"useTabAsNavigation.js","names":["React","useTabAsNavigation","_ref","enabled","config","editor","enhancedConfig","useMemo","plugins","filteredPlugins","filter","plugin","pluginName","_objectSpread"],"sources":["../../src/TextEditor/useTabAsNavigation.ts"],"sourcesContent":["import type { ClassicEditor, EditorConfig } from 'ckeditor5'\nimport React from 'react'\n\ninterface UseTabAsNavigationProps {\n enabled: boolean\n config: EditorConfig\n editor: ClassicEditor | null\n}\n\ninterface UseTabAsNavigationReturn {\n config: EditorConfig\n}\n\n// TODO - delete\nexport const useTabAsNavigation = ({\n enabled,\n config,\n editor,\n}: UseTabAsNavigationProps): UseTabAsNavigationReturn => {\n const enhancedConfig = React.useMemo(() => {\n if (!enabled || !config.plugins) {\n return config\n }\n\n // Remove TabSpacesPlugin when tabAsNavigation is enabled\n const filteredPlugins = config.plugins.filter((plugin) => {\n return typeof plugin === 'string'\n ? plugin !== 'TabSpacesPlugin'\n : plugin?.pluginName !== 'TabSpacesPlugin'\n })\n\n return {\n ...config,\n plugins: filteredPlugins,\n }\n }, [enabled, config])\n\n return { config: enhancedConfig }\n}\n"],"mappings":";;;;;;AACA,OAAOA,KAAK,MAAM,OAAO;AAYzB;AACA,OAAO,IAAMC,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAI0B;EAAA,IAHvDC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,MAAM,GAAAF,IAAA,CAANE,MAAM;IACNC,MAAM,GAAAH,IAAA,CAANG,MAAM;EAEN,IAAMC,cAAc,GAAGN,KAAK,CAACO,OAAO,CAAC,YAAM;IACzC,IAAI,CAACJ,OAAO,IAAI,CAACC,MAAM,CAACI,OAAO,EAAE;MAC/B,OAAOJ,MAAM;IACf;;IAEA;IACA,IAAMK,eAAe,GAAGL,MAAM,CAACI,OAAO,CAACE,MAAM,CAAC,UAACC,MAAM,EAAK;MACxD,OAAO,OAAOA,MAAM,KAAK,QAAQ,GAC7BA,MAAM,KAAK,iBAAiB,GAC5B,CAAAA,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEC,UAAU,MAAK,iBAAiB;IAC9C,CAAC,CAAC;IAEF,OAAAC,aAAA,CAAAA,aAAA,KACKT,MAAM;MACTI,OAAO,EAAEC;IAAe;EAE5B,CAAC,EAAE,CAACN,OAAO,EAAEC,MAAM,CAAC,CAAC;EAErB,OAAO;IAAEA,MAAM,EAAEE;EAAe,CAAC;AACnC,CAAC"}
|
|
@@ -57,7 +57,9 @@ export var getDefaultConfig = function getDefaultConfig() {
|
|
|
57
57
|
licenseKey: CK_EDITOR_LICENSE_KEY,
|
|
58
58
|
language: getValidEditorLocale(locale),
|
|
59
59
|
translations: [getEditorTranslation(locale)],
|
|
60
|
-
plugins: [Alignment, AutoLink, Bold, Clipboard, Essentials, FontBackgroundColor, FontColor, FontSize, GeneralHtmlSupport, Indent, IndentBlock, Italic, Link, List, ListProperties, Paragraph, Strikethrough, Table, TableCaption, TableCellProperties, TableColumnResize, TableProperties, TableToolbar, Underline, Image, ImageInsert, ImageToolbar, CutPlugin, PastePlugin, PasteAsTextPlugin, IndentPaddingToMarginPlugin, TabSpacesPlugin
|
|
60
|
+
plugins: [Alignment, AutoLink, Bold, Clipboard, Essentials, FontBackgroundColor, FontColor, FontSize, GeneralHtmlSupport, Indent, IndentBlock, Italic, Link, List, ListProperties, Paragraph, Strikethrough, Table, TableCaption, TableCellProperties, TableColumnResize, TableProperties, TableToolbar, Underline, Image, ImageInsert, ImageToolbar, CutPlugin, PastePlugin, PasteAsTextPlugin, IndentPaddingToMarginPlugin, TabSpacesPlugin // TODO - delete
|
|
61
|
+
],
|
|
62
|
+
|
|
61
63
|
toolbar: ['bold', 'italic', 'underline', 'strikethrough', '|', 'alignment:left', 'alignment:center', 'alignment:right', '|', 'bulletedList', 'numberedList', '|', 'outdent', 'indent', '|', 'cut', 'paste', 'pasteAsText', '|', 'fontSize', '|', 'fontColor', 'fontBackgroundColor', '|', 'undo', 'redo'],
|
|
62
64
|
fontSize: {
|
|
63
65
|
options: [{
|
|
@@ -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 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"],"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,wCA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ACF,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, // TODO - delete\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"],"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,EAAE;AAAU,CAAC,EACpB;EAAEA,KAAK,EAAE;AAAU,CAAC,EACpB;EAAEA,KAAK,EAAE;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I,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,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_3__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/672f459/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/672f459/packages/text-editor/src/TextEditor/TextEditor.types.ts#L41"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
"name": "id",
|
|
@@ -30,7 +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/
|
|
33
|
+
"sourceUrl": "https://github.com/procore/core/blob/672f459/packages/text-editor/src/TextEditor/TextEditor.types.ts#L10"
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
"name": "initialValue",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"deprecated": "`initialValue` has been deprecated and will be removed in a future version.\nPlease use the `value` prop instead",
|
|
43
43
|
"deprecatedSince": "10.20.0",
|
|
44
44
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
45
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
45
|
+
"sourceUrl": "https://github.com/procore/core/blob/672f459/packages/text-editor/src/TextEditor/TextEditor.types.ts#L20"
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
"name": "locale",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"description": "Locale which will be used for localization. Can be passed directly or\nset by wrapping components in I18n provider.",
|
|
53
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>",
|
|
54
54
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
55
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
55
|
+
"sourceUrl": "https://github.com/procore/core/blob/672f459/packages/text-editor/src/TextEditor/TextEditor.types.ts#L48"
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
"name": "plugins",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
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.",
|
|
63
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>",
|
|
64
64
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
65
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
65
|
+
"sourceUrl": "https://github.com/procore/core/blob/672f459/packages/text-editor/src/TextEditor/TextEditor.types.ts#L57"
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
"name": "value",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"description": "The current value of the editor",
|
|
73
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>",
|
|
74
74
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
75
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
75
|
+
"sourceUrl": "https://github.com/procore/core/blob/672f459/packages/text-editor/src/TextEditor/TextEditor.types.ts#L27"
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
"name": "config",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"description": "Configuration function for customizing the editor",
|
|
83
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>",
|
|
84
84
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
85
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
85
|
+
"sourceUrl": "https://github.com/procore/core/blob/672f459/packages/text-editor/src/TextEditor/TextEditor.types.ts#L66"
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
"name": "onAfterDestroy",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"description": "Callback fired after the editor instance is destroyed",
|
|
93
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>",
|
|
94
94
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
95
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
95
|
+
"sourceUrl": "https://github.com/procore/core/blob/672f459/packages/text-editor/src/TextEditor/TextEditor.types.ts#L116"
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
98
|
"name": "onBlur",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"description": "Callback fired when the editor loses focus",
|
|
103
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>",
|
|
104
104
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
105
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
105
|
+
"sourceUrl": "https://github.com/procore/core/blob/672f459/packages/text-editor/src/TextEditor/TextEditor.types.ts#L89"
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
"name": "onChange",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"description": "Callback fired when the editor content changes",
|
|
113
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>",
|
|
114
114
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
115
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
115
|
+
"sourceUrl": "https://github.com/procore/core/blob/672f459/packages/text-editor/src/TextEditor/TextEditor.types.ts#L75"
|
|
116
116
|
},
|
|
117
117
|
{
|
|
118
118
|
"name": "onDirty",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"description": "Callback fired when the editor becomes dirty (content differs from initial value)",
|
|
123
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>",
|
|
124
124
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
125
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
125
|
+
"sourceUrl": "https://github.com/procore/core/blob/672f459/packages/text-editor/src/TextEditor/TextEditor.types.ts#L123"
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
"name": "onError",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"description": "Callback fired when an error occurs in the editor",
|
|
133
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>",
|
|
134
134
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
135
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
135
|
+
"sourceUrl": "https://github.com/procore/core/blob/672f459/packages/text-editor/src/TextEditor/TextEditor.types.ts#L96"
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
138
|
"name": "onFocus",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"description": "Callback fired when the editor gains focus",
|
|
143
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>",
|
|
144
144
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
145
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
145
|
+
"sourceUrl": "https://github.com/procore/core/blob/672f459/packages/text-editor/src/TextEditor/TextEditor.types.ts#L82"
|
|
146
146
|
},
|
|
147
147
|
{
|
|
148
148
|
"name": "onInit",
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
"description": "Callback fired when the editor is ready",
|
|
153
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>",
|
|
154
154
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
155
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
155
|
+
"sourceUrl": "https://github.com/procore/core/blob/672f459/packages/text-editor/src/TextEditor/TextEditor.types.ts#L109"
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
"name": "onKeyDown",
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
"description": "Callback fired when a key is pressed in the editor",
|
|
163
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>",
|
|
164
164
|
"sourceFile": "TextEditor/TextEditor.types.ts",
|
|
165
|
-
"sourceUrl": "https://github.com/procore/core/blob/
|
|
165
|
+
"sourceUrl": "https://github.com/procore/core/blob/672f459/packages/text-editor/src/TextEditor/TextEditor.types.ts#L132"
|
|
166
166
|
}
|
|
167
167
|
],
|
|
168
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/672f459/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/672f459/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/672f459/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/672f459/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/672f459/packages/text-editor/src/TextEditorOutput/TextEditorOutput.types.ts#L7"
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
36
|
"description": ""
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@procore/text-editor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
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",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"exports": {
|
|
30
30
|
".": "./dist/index.js",
|
|
31
31
|
"./jestConfig": {
|
|
32
|
-
"
|
|
32
|
+
"types": "./jestConfig.d.ts",
|
|
33
33
|
"require": "./jestConfig.js",
|
|
34
|
-
"
|
|
34
|
+
"import": "./jestConfig.js"
|
|
35
35
|
},
|
|
36
36
|
"./dist/_typedoc/*.json": "./dist/_typedoc/*.json",
|
|
37
37
|
"./dist/_typedoc/**/*.json": "./dist/_typedoc/**/*.json"
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
"lint:types": "tsc -p tsconfig.prod.json --noEmit",
|
|
63
63
|
"lint:types:watch": "tsc -p . --noEmit --watch",
|
|
64
64
|
"storybook": "storybook dev -p 6008",
|
|
65
|
-
"test": "TZ=America/Los_Angeles jest --
|
|
65
|
+
"test": "TZ=America/Los_Angeles jest --runInBand --logHeapUsage",
|
|
66
66
|
"test:update": "TZ=America/Los_Angeles jest --runInBand -u",
|
|
67
67
|
"test:watch": "yarn run test --watch"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@procore/core-react": "^12.
|
|
70
|
+
"@procore/core-react": "^12.33.0",
|
|
71
71
|
"@procore/globalization-toolkit": ">= 3 < 4",
|
|
72
72
|
"ckeditor5": "^46.0.1",
|
|
73
73
|
"react": ">=16.8.0 < 19",
|
|
@@ -91,17 +91,12 @@
|
|
|
91
91
|
"@babel/preset-react": "7.18.6",
|
|
92
92
|
"@babel/preset-typescript": "7.18.6",
|
|
93
93
|
"@babel/register": "7.18.9",
|
|
94
|
-
"@ckeditor/ckeditor5-dev-utils": "^43.1.0",
|
|
95
94
|
"@ckeditor/ckeditor5-dev-webpack-plugin": "^31.1.13",
|
|
96
|
-
"@procore/core-react": "^12.
|
|
95
|
+
"@procore/core-react": "^12.33.0",
|
|
97
96
|
"@procore/globalization-toolkit": "3.0.0",
|
|
98
|
-
"@
|
|
99
|
-
"@storybook/addon-docs": "^7.5.3",
|
|
100
|
-
"@storybook/addon-interactions": "^7.5.3",
|
|
97
|
+
"@storybook/addon-webpack5-compiler-swc": "^4.0.2",
|
|
101
98
|
"@storybook/jest": "^0.2.3",
|
|
102
|
-
"@storybook/
|
|
103
|
-
"@storybook/react": "^7.5.3",
|
|
104
|
-
"@storybook/react-webpack5": "^7.5.3",
|
|
99
|
+
"@storybook/react-webpack5": "^9.1.16",
|
|
105
100
|
"@storybook/testing-library": "^0.2.2",
|
|
106
101
|
"@testing-library/dom": "8.20.0",
|
|
107
102
|
"@testing-library/jest-dom": "5.16.4",
|
|
@@ -126,6 +121,7 @@
|
|
|
126
121
|
"eslint-config-prettier": "8.6.0",
|
|
127
122
|
"eslint-config-react-app": "^7.0.1",
|
|
128
123
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
124
|
+
"eslint-plugin-storybook": "^9.1.16",
|
|
129
125
|
"fs-extra": "11.1.1",
|
|
130
126
|
"glob": "8.1.0",
|
|
131
127
|
"jest": "29.4.1",
|
|
@@ -134,7 +130,7 @@
|
|
|
134
130
|
"react": "18.3.1",
|
|
135
131
|
"react-dom": "18.3.1",
|
|
136
132
|
"rimraf": "^6.0.1",
|
|
137
|
-
"storybook": "^
|
|
133
|
+
"storybook": "^9.1.16",
|
|
138
134
|
"style-loader": "^4.0.0",
|
|
139
135
|
"styled-components": "6.1.18",
|
|
140
136
|
"ts-jest": "^29.0.5",
|