File tree Expand file tree Collapse file tree 3 files changed +45
-2
lines changed Expand file tree Collapse file tree 3 files changed +45
-2
lines changed Original file line number Diff line number Diff line change 3131 "electron-localshortcut" : " ^3.2.1" ,
3232 "electron-notarize" : " ^1.2.1" ,
3333 "electron-settings" : " ^4.0.2" ,
34+ "fuse.js" : " ^6.6.2" ,
3435 "javascript-time-ago" : " ^2.3.13" ,
3536 "nsfwjs" : " ^2.4.2" ,
3637 "konva" : " ^8.3.13" ,
Original file line number Diff line number Diff line change 11@import '../assets/css/theme.css';
22<template >
33 <div class =" animatable_content_box " >
4+
5+ <b-form-input
6+ onkeypress =" return event.keyCode != 13;"
7+ size =" sm"
8+ placeholder =" Search by prompt text"
9+ v-model =" searchText"
10+ autofocus
11+ debounce =" 200"
12+ style =" max-width : 240px ; float : left ; margin-right : 30px ;"
13+ id =" searchText"
14+ />
15+
416 <div @click =" toggle_order()" style =" float :right ; margin-bottom : 20px ;" class =" l_button" >
517 {{this.app_state.show_history_in_oldest_first ? "Oldest": "Newest"}} First
618 </div >
@@ -56,6 +68,7 @@ import ImageItem from '../components/ImageItem.vue'
5668import {share_on_arthub } from ' ../utils.js'
5769
5870import Vue from ' vue'
71+ import Fuse from ' fuse.js'
5972
6073export default {
6174 name: ' History' ,
@@ -69,7 +82,9 @@ export default {
6982
7083 },
7184 data () {
72- return {};
85+ return {
86+ searchText: ' '
87+ };
7388 },
7489 methods: {
7590 delete_hist (k ){
@@ -78,7 +93,20 @@ export default {
7893
7994 get_history () {
8095 let history = Object .values (this .app_state .app_data .history );
81- return this .app_state .show_history_in_oldest_first ? history : history .reverse ();
96+ const that = this ;
97+ const list = this .app_state .show_history_in_oldest_first ? history : history .reverse ();
98+
99+ if (that .searchText .trim () === ' ' ) {
100+ return list;
101+ }
102+
103+ const fuse = new Fuse (list, {
104+ keys: [' prompt' ],
105+ useExtendedSearch: true ,
106+ });
107+
108+ return fuse .search (that .searchText ).map (r => r .item );
109+
82110 },
83111
84112 toggle_order () {
You can’t perform that action at this time.
0 commit comments