Skip to content

Commit

Permalink
feat: better for print
Browse files Browse the repository at this point in the history
  • Loading branch information
oeyoews committed Feb 27, 2025
1 parent f9cf2c2 commit 9049061
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 11 deletions.
4 changes: 3 additions & 1 deletion plugins/oeyoews/neotw-cmp/tiddlers/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class AutoCompleteWidget extends Widget {
const { closeCmp, openCmp } = require('./plugins/utils');

const createElement = $tw.utils.domMaker;
const domNode = document.createElement('div');
const domNode = createElement('div', {
class: 'print:hidden',
});

// 注册事件
$tw.rootWidget.addEventListener('open-cmp', () => openCmp(domNode));
Expand Down
2 changes: 1 addition & 1 deletion plugins/oeyoews/neotw-copy-code2/tiddlers/copy-code.tid
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ tags: $:/tags/Global
\widget $codeblock(code, language)
<div class="group relative">
<!-- scale-0 group-hover:scale-100 -->
<$button class="z-[1] absolute right-0 m-1 p-0 transition-all delay-200 size-8" message="tm-copy-to-clipboard" param=<<code>> tooltip="copy code">
<$button class="z-[1] absolute right-0 m-1 p-0 transition-all delay-200 size-8 print:hidden" message="tm-copy-to-clipboard" param=<<code>> tooltip="copy code">
{{$:/core/images/copy-clipboard}}
</$button>
<$genesis $type="$codeblock" $remappable="no" code=<<code>> language=<<language>> />
Expand Down
4 changes: 2 additions & 2 deletions plugins/oeyoews/neotw-menubar/tiddlers/pageTemplate.tid
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ title: $:/plugins/oeyoews/neotw-menubar/PageTemplate
tags: $:/tags/PageTemplate

<$list filter="[[$:/StoryList]get[list]count[]!match[0]]">
<div class="fixed top-2 hidden md:block tc-adjust-top-of-scroll oeyoews-menu-bar-width" >
<div class="fixed top-2 hidden md:block tc-adjust-top-of-scroll oeyoews-menu-bar-width print:hidden" >
<$vue-menubar />
</div>
</$list>

<$list filter="[[$:/StoryList]get[list]count[]match[0]]">
<div class="fixed top-2 inset-x-8 hidden md:block opacity-0 tc-adjust-top-of-scroll h-[42px]">
<div class="fixed top-2 inset-x-8 hidden md:block opacity-0 tc-adjust-top-of-scroll h-[42px] print:hidden">
</div>
</$list>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
title: $:/plugins/oeyoews/neotw-tiddlers-view/viewTemplate
tags: $:/tags/PageTemplate

<div class="fixed bottom-2 left-2">
<div class="fixed bottom-2 left-2 print:hidden">
<$widget-43kerdga />
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tags: $:/tags/Macro
\end

\define opublish()
<div class="inline neotw-publish-status">
<div class="inline neotw-publish-status print:hidden">
<$select class="border-none rounded appearance-none p-0.5 capitalize cursor-pointer" field="publish" tiddler=<<currentTiddler>> tooltip='status' default="status">
<option disabled class="bg-teal-400" value="status">❓ status</option>
<option class="bg-lime-400" value="public">🔥 public ({{{ [field:publish[public]count[]] }}})</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ title: $:/core/ui/ViewTemplate/tags
tags: $:/tags/ViewTemplate

<!-- hidden -->
<div class="tc-tags-wrapper">
<div class="tc-tags-wrapper print:hidden">
<$list filter="[all[current]tags[]limit[1]sort[title]]">
<$text text={{{ [[$:/plugins/oeyoews/tiddlywiki-tiddler-info/config]get[otags]else[🎯]] }}} />
</$list>
Expand Down
6 changes: 3 additions & 3 deletions plugins/oeyoews/tiddlywiki-tiddler-info/tiddlers/ui/title.tid
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fill:$(foregroundColor)$;

<div class="tc-tiddler-title mb-4">
<div class="tc-titlebar">
<span class="tc-tiddler-controls !float-none flex justify-end mb-4">
<span class="tc-tiddler-controls !float-none flex justify-end mb-4 print:hidden">
<$let env={{{ [[$:/info/url/protocol]get[text]] }}}>
<%if [<env>match[http:]] %>
<$list filter="[all[shadows+tiddlers]tag[$:/tags/ViewToolbar]!has[draft.of]] :filter[lookup[$:/config/ViewToolbarButtons/Visibility/]!match[hide]]" storyview="pop" variable="listItem">
Expand Down Expand Up @@ -43,10 +43,10 @@ fill:$(foregroundColor)$;
<$let env={{{ [[$:/info/url/protocol]get[text]] }}}>
<%if [<env>match[http:]] %>
<%if [<currentTiddler>!prefix[$:/]!is[missing]!is[binary]!tag[Journal]!is[tag]] %>
<$button class="tc-btn-invisible renaming-tiddler-ai" message="th-renaming-tiddler-ai" > {{$:/core/images/ai-edit-button}}</$button>
<$button class="tc-btn-invisible print:hidden renaming-tiddler-ai" message="th-renaming-tiddler-ai" > {{$:/core/images/ai-edit-button}}</$button>
<!-- https://talk.tiddlywiki.org/t/finding-tiddlers-with-only-one-tag/10946/2 -->
<%if [<currentTiddler>field:tags[剪藏]] [<currentTiddler>field:tags[]] %>
<$button class="tc-btn-invisible recommend-tiddler-ai data-html2canvas-ignore" message="th-recommendTag" >
<$button class="tc-btn-invisible print:hidden recommend-tiddler-ai data-html2canvas-ignore" message="th-recommendTag" >
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><g fill="none" stroke="lightgray" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M3 8v4.172a2 2 0 0 0 .586 1.414l5.71 5.71a2.41 2.41 0 0 0 3.408 0l3.592-3.592a2.41 2.41 0 0 0 0-3.408l-5.71-5.71A2 2 0 0 0 9.172 6H5a2 2 0 0 0-2 2"/><path d="m18 19l1.592-1.592a4.82 4.82 0 0 0 0-6.816L15 6m-8 4h-.01"/></g></svg>
</$button>
<%endif %>
Expand Down
6 changes: 6 additions & 0 deletions themes/nico/notebook/base.tid
Original file line number Diff line number Diff line change
Expand Up @@ -662,4 +662,10 @@ div.tc-tab-buttons button.tc-tab-selected {
.tc-tiddler-info {
background: transparent !important;
border: none !important;
}

@media print {
.tc-tiddler-controls {
display: none;
}
}
2 changes: 1 addition & 1 deletion themes/nico/notebook/ui/Sidebar.tid
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $:/config/SideBarSegments/Visibility/$(listItem)$
<$reveal state="$:/state/notebook-sidebar" type="match" text="yes" default="no" retain="yes" animate="no">
<$scrollable fallthrough="no">
<!-- use z-0 to prevent cm6 fullscreen -->
<div class="nc-sidebar p-2 z-0 hidden lg:block top-[60px] rounded-lg mx-4 bottom-[30px] dark:shadow-lg">
<div class="nc-sidebar p-2 z-0 hidden lg:block top-[60px] rounded-lg mx-4 bottom-[30px] dark:shadow-lg print:hidden">
<$list filter="[all[shadows+tiddlers]tag[$:/themes/nico/notebook/tags/Sidebar]!has[draft.of]]" variable="listItem">
<$reveal type="nomatch" state=<<config-title>> text="hide" tag="div">
<$transclude tiddler=<<listItem>> mode="inline"/>
Expand Down

0 comments on commit 9049061

Please sign in to comment.