mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +00:00
Text-slicer: updates
* Add warning in document tiddler toolbar if tiddler already exists * Live preview document in new window * Fix slicer.js bug that was preventing the list field of headings from being filled in correctly * Rationalise some class names
This commit is contained in:
parent
51d771a074
commit
bc448ce1fd
@ -44,7 +44,10 @@ The document itself is represented by a tiddler with the following fields:
|
||||
|
||||
* ''toc-type'': the text "document"
|
||||
* ''title'': the text ''"Sliced up "'' plus the title of the tiddler that was sliced
|
||||
* ''text'': left blank for description of the document
|
||||
* ''text'': Available for comments about the document
|
||||
* ''list'': ordered list of tiddlers making up the root level of this document
|
||||
|
||||
Note that the relationship between the document and component tiddlers is that the components are listed in the ''list'' field. This differs from the relationship between headings and their components, which use the ''tags'' field of the components to tie them to the heading. The purpose of this difference is to make it possible to clone doument tiddlers without losing the connection to the constituent parts.
|
||||
|
||||
!!! Headings
|
||||
|
||||
|
4
plugins/tiddlywiki/text-slicer/export-full-doc.tid
Normal file
4
plugins/tiddlywiki/text-slicer/export-full-doc.tid
Normal file
@ -0,0 +1,4 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/export-full-doc
|
||||
tags: $:/tags/ViewTemplate
|
||||
|
||||
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/template-tiddler" listItem="item"/>
|
@ -164,16 +164,17 @@ Slicer.prototype.processNode = function(domNode) {
|
||||
var tagName = domNode.tagName.toLowerCase();
|
||||
if(tagName === "h1" || tagName === "h2" || tagName === "h3" || tagName === "h4") {
|
||||
if(!this.isBlank(text)) {
|
||||
title = this.makeUniqueTitle("heading",text);
|
||||
parentTitle = this.popParentStackUntil(tagName);
|
||||
tags = [parentTitle];
|
||||
if(domNode.className.trim() !== "") {
|
||||
tags = tags.concat(domNode.className.split(" "));
|
||||
}
|
||||
this.addToList(parentTitle,text);
|
||||
this.addToList(parentTitle,title);
|
||||
this.parentStack.push({type: tagName, title: this.addTiddler({
|
||||
"toc-type": "heading",
|
||||
"toc-heading-level": tagName,
|
||||
title: this.makeUniqueTitle("heading",text),
|
||||
title: title,
|
||||
text: text,
|
||||
list: [],
|
||||
tags: tags
|
||||
|
@ -21,6 +21,11 @@ tags: $:/tags/Stylesheet
|
||||
margin-left: 24px;
|
||||
}
|
||||
|
||||
.tc-document-preview-column .tc-sliced-document {
|
||||
margin-bottom: 3px;
|
||||
border-bottom: 2px solid <<colour muted-foreground>>;
|
||||
}
|
||||
|
||||
.tc-view-template-document-tiddler-heading {
|
||||
border-top: 2px solid <<colour muted-foreground>>;
|
||||
}
|
||||
@ -29,11 +34,6 @@ tags: $:/tags/Stylesheet
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.tc-sliced-document {
|
||||
margin-bottom: 3px;
|
||||
border-bottom: 2px solid <<colour muted-foreground>>;
|
||||
}
|
||||
|
||||
.tc-document-tiddler {
|
||||
font-family: Georgia, Times, 'Times New Roman', serif;
|
||||
}
|
||||
@ -57,7 +57,7 @@ tags: $:/tags/Stylesheet
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.tc-document-preview-column .tc-table-of-contents {
|
||||
.tc-document-preview-column .tc-sliced-document-body {
|
||||
margin-left: 24px;
|
||||
}
|
||||
|
||||
|
@ -21,13 +21,15 @@ $:/config/plugins/tiddlywiki/text-slicer/heading-status/$(currentTiddler)$
|
||||
|
||||
<$checkbox tiddler=<<config-show-toolbar>> field="text" checked="yes" unchecked="no" default="no"> Show toolbar</$checkbox>
|
||||
|
||||
{{||$:/plugins/tiddlywiki/text-slicer/templates/view-document}}
|
||||
|
||||
</div>
|
||||
|
||||
<div class='tc-table-of-contents'>
|
||||
<div class='tc-sliced-document-body'>
|
||||
|
||||
<$set name="tv-show-toolbar" value={{$(config-show-toolbar)$}}>
|
||||
|
||||
<$list filter="[tag<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/template-tiddler" listItem="item"/>
|
||||
<$list filter="[list<currentTiddler>!has[draft.of]]" template="$:/plugins/tiddlywiki/text-slicer/templates/template-tiddler" listItem="item"/>
|
||||
|
||||
</$set>
|
||||
|
||||
|
@ -8,6 +8,8 @@ $(tv-heading-status-config-title)$/$(currentTiddler)$
|
||||
<$set name="tv-heading-status-config-title" value=<<config-heading-status>>>
|
||||
<div class="tc-document-tiddler">
|
||||
<div class="tc-document-tiddler-toolbar">
|
||||
|
||||
<$list filter="[<tv-show-gadgets>!prefix[no]]" variable="hasToolbar">
|
||||
<$reveal type="nomatch" state=<<tv-heading-status-config-title>> text="open" default=<<tv-default-heading-state>>>
|
||||
<$button set=<<tv-heading-status-config-title>> setTo="open" class="tc-btn-invisible">
|
||||
{{$:/core/images/down-arrow}}
|
||||
@ -18,6 +20,8 @@ $(tv-heading-status-config-title)$/$(currentTiddler)$
|
||||
{{$:/core/images/right-arrow}}
|
||||
</$button>
|
||||
</$reveal>
|
||||
</$list>
|
||||
|
||||
</div>
|
||||
<$link tag="$level$" class="tc-document-tiddler-link">
|
||||
<$view field="text"/>
|
||||
|
@ -0,0 +1,6 @@
|
||||
title: $:/plugins/tiddlywiki/text-slicer/templates/view-document
|
||||
|
||||
<$button>
|
||||
<$action-sendmessage $message="tm-open-window" $param=<<currentTiddler>> template="$:/plugins/tiddlywiki/text-slicer/templates/export-full-doc" tv-show-toolbar="no" tv-show-gadgets="no"/>
|
||||
View document
|
||||
</$button>
|
@ -18,6 +18,11 @@ cancel
|
||||
<$action-deletetiddler $tiddler=<<renameProxyTitle>>/>
|
||||
rename
|
||||
</$button>
|
||||
<$set name="proxy-title" value={{$(renameProxyTitle)$}}>
|
||||
<$list filter="""[<proxy-title>is[tiddler]]""">
|
||||
Warning: tiddler already exists
|
||||
</$list>
|
||||
</$set>
|
||||
</$reveal>
|
||||
</div>
|
||||
\end
|
||||
|
Loading…
Reference in New Issue
Block a user