File tree Expand file tree Collapse file tree 3 files changed +14
-10
lines changed
src/webviews/components/issue
view-issue-screen/mainpanel Expand file tree Collapse file tree 3 files changed +14
-10
lines changed Original file line number Diff line number Diff line change 11### [ Report an Issue] ( https://github.com/atlassian/atlascode/issues )
22
3+ ## What's new in 4.0.21
4+
5+ ### Bug fixes
6+
7+ - Fixed issue description losing line breaks and formatting in edit mode after save (HTML-to-ADF conversion now preserves line breaks as hardBreak nodes)
8+
39## What's new in 4.0.20
410
511### Features
Original file line number Diff line number Diff line change 1+ import { JSONTransformer } from '@atlaskit/editor-json-transformer' ;
12import { WikiMarkupTransformer } from '@atlaskit/editor-wikimarkup-transformer' ;
23
34// ADF (Atlassian Document Format) node structure
@@ -85,17 +86,15 @@ export function convertAdfToWikimarkup(adf: AdfNode | string | null | undefined)
8586 // Check if it's valid ADF
8687 if ( adfDoc && adfDoc . type === 'doc' && adfDoc . version === 1 ) {
8788 try {
88- // Validate ADF structure before transformation
8989 if ( ! adfDoc . content || ! Array . isArray ( adfDoc . content ) ) {
9090 console . warn ( 'Invalid ADF structure: missing or invalid content array' ) ;
9191 return extractPlainTextFromAdf ( adfDoc ) ;
9292 }
9393
94- // WikiMarkupTransformer provides its own schema
95- const transformer = new WikiMarkupTransformer ( ) ;
96- // Convert ADF to WikiMarkup
97- const wikimarkup = transformer . encode ( adfDoc ) ;
98- return wikimarkup ;
94+ const jsonTransformer = new JSONTransformer ( ) ;
95+ const pmNode = jsonTransformer . parse ( adfDoc ) ;
96+ const wikiTransformer = new WikiMarkupTransformer ( ) ;
97+ return wikiTransformer . encode ( pmNode ) ;
9998 } catch ( transformError ) {
10099 console . warn ( 'WikiMarkup transformer failed, falling back to plain text extraction:' , transformError ) ;
101100 // Fallback to plain text extraction
Original file line number Diff line number Diff line change @@ -92,21 +92,20 @@ const IssueMainPanel: React.FC<Props> = ({
9292
9393 // Use centralized editor state
9494 const { openEditor, closeEditor, isEditorActive } = useEditorState ( ) ;
95- // Handle descriptionText - convert ADF object to appropriate format for editor
95+ // Use raw description ( ADF or string) for the editor; no HTML→ADF conversion.
9696 const getDescriptionTextForEditor = React . useCallback ( ( ) => {
9797 if (
9898 typeof defaultDescription === 'object' &&
99+ defaultDescription !== null &&
99100 defaultDescription . version === 1 &&
100101 defaultDescription . type === 'doc'
101102 ) {
102- // For new Atlaskit editor: convert ADF to JSON string
103103 if ( isAtlaskitEditorEnabled ) {
104104 return JSON . stringify ( defaultDescription ) ;
105105 }
106- // For legacy editor: convert ADF to WikiMarkup
107106 return convertAdfToWikimarkup ( defaultDescription ) ;
108107 }
109- return defaultDescription || '' ;
108+ return typeof defaultDescription === 'string' ? defaultDescription : '' ;
110109 } , [ defaultDescription , isAtlaskitEditorEnabled ] ) ;
111110
112111 const [ descriptionText , setDescriptionText ] = React . useState ( ( ) => getDescriptionTextForEditor ( ) ) ;
You can’t perform that action at this time.
0 commit comments