Feat/import options (#9465)

* feat: add $:/tags/ImportOptions support on import panel

* feat: style of import option

* fix: conditional show import option

* Delete ImportOptions.tid

* feat: allow multiple import options

* Revert "Delete ImportOptions.tid"

This reverts commit 3487e3dac5.

* DEBUG options

* remove debug files

* Create #9465.tid
This commit is contained in:
lin onetwo
2025-12-17 14:44:06 +00:00
committed by GitHub
parent 48eeb4603a
commit 05f3e6d5a0
3 changed files with 47 additions and 0 deletions
+21
View File
@@ -49,6 +49,27 @@ title: $:/core/ui/ImportListing
\end
\whitespace trim
<$let importJson={{{ [{$:/Import}] }}}>
<$let importTitles={{{ [<importJson>jsonindexes[tiddlers]] }}}>
<$let importTypes={{{ [(importTitles)] :map[<importJson>jsonget[tiddlers],<currentTiddler>,[type]] }}}>
<$let anyMatch={{{ [all[shadows+tiddlers]tag[$:/tags/ImportOptions]get[condition]] :map[(importTypes)subfilter<currentTiddler>] +[!is[blank]limit[1]] }}}>
<%if [<anyMatch>!is[blank]] %>
<div class="tc-import-option">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ImportOptions]]" variable="importOption">
<$let condition={{{ [<importOption>get[condition]] }}}>
<$let hasMatch={{{ [(importTypes)subfilter<condition>limit[1]] }}}>
<%if [<hasMatch>!is[blank]] %>
<$transclude tiddler=<<importOption>>/>
<%endif%>
</$let>
</$let>
</$list>
</div>
<%endif%>
</$let>
</$let>
</$let>
</$let>
<div class="tc-table-wrapper">
<table class="tc-import-table">
<tbody>
@@ -0,0 +1,15 @@
title: $:/changenotes/5.4.0/#9465
description: Import UI now conditionally displays file-type-specific import options
tags: $:/tags/ChangeNote
release: 5.4.0
change-type: enhancement
change-category: hackability
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9465
github-contributors: linonetwo
The import UI now displays import options based on the file types being imported. Import options are only shown when relevant files are detected, an example is:
```tid
tags: $:/tags/ImportOptions
condition: [match[text/x-markdown]] :or[match[text/markdown]]
```
+11
View File
@@ -2395,6 +2395,17 @@ html body.tc-body.tc-single-tiddler-window {
** Import table
*/
.tc-import-option {
display: flex;
flex-direction: column;
gap: 0.5em;
margin: 0.5em 0;
padding: 0.5em;
background: <<colour tiddler-editor-background>>;
border: 1px solid <<colour tiddler-editor-border>>;
border-radius: 4px;
}
.tc-import-table {
width: 100%;
}