mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Fix task list checkbox toggle to work with YAML front matter (#25184)
Fixes #25160. `data-source-position` of checkboxes in a task list was incorrect whenever there was YAML front matter. This would result in issue content or PR descriptions getting corrupted with random `x` or space characters when a user checked or unchecked a task.
This commit is contained in:
		@@ -76,7 +76,8 @@ func IsSummary(node ast.Node) bool {
 | 
			
		||||
// TaskCheckBoxListItem is a block that represents a list item of a markdown block with a checkbox
 | 
			
		||||
type TaskCheckBoxListItem struct {
 | 
			
		||||
	*ast.ListItem
 | 
			
		||||
	IsChecked bool
 | 
			
		||||
	IsChecked      bool
 | 
			
		||||
	SourcePosition int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// KindTaskCheckBoxListItem is the NodeKind for TaskCheckBoxListItem
 | 
			
		||||
@@ -86,6 +87,7 @@ var KindTaskCheckBoxListItem = ast.NewNodeKind("TaskCheckBoxListItem")
 | 
			
		||||
func (n *TaskCheckBoxListItem) Dump(source []byte, level int) {
 | 
			
		||||
	m := map[string]string{}
 | 
			
		||||
	m["IsChecked"] = strconv.FormatBool(n.IsChecked)
 | 
			
		||||
	m["SourcePosition"] = strconv.FormatInt(int64(n.SourcePosition), 10)
 | 
			
		||||
	ast.DumpHelper(n, source, level, m, nil)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user