mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-02 04:47:01 +08:00
@ -244,6 +244,7 @@ feature:
|
||||
localization:
|
||||
title: Localization
|
||||
subtitle: Allow GitJournal to be translated
|
||||
inlineTags: Inline Tags
|
||||
|
||||
feature_timeline:
|
||||
title: Feature Timeline
|
||||
|
@ -7,6 +7,7 @@ import 'package:gitjournal/core/links_loader.dart';
|
||||
import 'package:gitjournal/core/md_yaml_doc_loader.dart';
|
||||
import 'package:gitjournal/core/note_notifier.dart';
|
||||
import 'package:gitjournal/core/notes_folder_fs.dart';
|
||||
import 'package:gitjournal/core/processors/inline_tags.dart';
|
||||
import 'package:gitjournal/error_reporting.dart';
|
||||
import 'package:gitjournal/settings.dart';
|
||||
import 'package:gitjournal/utils/datetime.dart';
|
||||
@ -62,6 +63,7 @@ class Note with NotesNotifier {
|
||||
// Computed from body
|
||||
String _summary;
|
||||
List<Link> _links;
|
||||
Set<String> _inlineTags;
|
||||
|
||||
static final _mdYamlDocLoader = MdYamlDocLoader();
|
||||
static final _linksLoader = LinksLoader();
|
||||
@ -150,6 +152,8 @@ class Note with NotesNotifier {
|
||||
_body = newBody;
|
||||
_summary = null;
|
||||
_links = null;
|
||||
_inlineTags = null;
|
||||
|
||||
_notifyModified();
|
||||
}
|
||||
|
||||
@ -185,6 +189,17 @@ class Note with NotesNotifier {
|
||||
_notifyModified();
|
||||
}
|
||||
|
||||
Set<String> get inlineTags {
|
||||
if (_loadState != NoteLoadState.Loaded) return {};
|
||||
|
||||
if (_inlineTags == null) {
|
||||
var tagPrefixes = Settings.instance.inlineTagPrefixes;
|
||||
var p = InlineTagsProcessor(tagPrefixes: tagPrefixes);
|
||||
_inlineTags = p.extractTags(body);
|
||||
}
|
||||
return _inlineTags;
|
||||
}
|
||||
|
||||
Map<String, dynamic> get extraProps {
|
||||
return _extraProps;
|
||||
}
|
||||
|
@ -525,6 +525,7 @@ typedef NoteMatcherAsync = Future<bool> Function(Note n);
|
||||
Set<String> _fetchTags(NotesFolder folder, Set<String> tags) {
|
||||
for (var note in folder.notes) {
|
||||
tags.addAll(note.tags);
|
||||
tags.addAll(note.inlineTags);
|
||||
}
|
||||
|
||||
for (var folder in folder.subFolders) {
|
||||
|
@ -2,7 +2,6 @@ import 'package:easy_localization/easy_localization.dart';
|
||||
|
||||
class Features {
|
||||
static bool perFolderConfig = false;
|
||||
static bool inlineTags = false;
|
||||
|
||||
static final all = <Feature>[
|
||||
Feature.basicSearch,
|
||||
@ -37,6 +36,7 @@ class Features {
|
||||
Feature.yamlTagsKey,
|
||||
Feature.customMetaData,
|
||||
Feature.localization,
|
||||
Feature.inlineTags,
|
||||
];
|
||||
|
||||
static final inProgress = <String>[
|
||||
@ -319,6 +319,14 @@ class Feature {
|
||||
tr("feature.localization.subtitle"),
|
||||
false,
|
||||
);
|
||||
|
||||
static final inlineTags = Feature(
|
||||
"inlineTags",
|
||||
DateTime(2020, 09, 02),
|
||||
tr("feature.inlineTags"),
|
||||
"",
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
// Feature Adding checklist
|
||||
|
@ -243,8 +243,9 @@ class SettingsListState extends State<SettingsList> {
|
||||
Navigator.of(context).push(route);
|
||||
},
|
||||
),
|
||||
if (Features.inlineTags)
|
||||
ListTile(
|
||||
ProOverlay(
|
||||
feature: Feature.inlineTags,
|
||||
child: ListTile(
|
||||
title: Text(tr("settings.tags.title")),
|
||||
subtitle: Text(tr("settings.tags.subtitle")),
|
||||
onTap: () {
|
||||
@ -255,6 +256,7 @@ class SettingsListState extends State<SettingsList> {
|
||||
Navigator.of(context).push(route);
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(tr('settings.images.title')),
|
||||
subtitle: Text(tr('settings.images.subtitle')),
|
||||
|
@ -57,7 +57,8 @@ class TagListingScreen extends StatelessWidget {
|
||||
var rootFolder = Provider.of<NotesFolderFS>(context);
|
||||
var folder = FlattenedNotesFolder(
|
||||
rootFolder,
|
||||
filter: (Note n) => n.tags.contains(tag),
|
||||
filter: (Note n) =>
|
||||
n.tags.contains(tag) || n.inlineTags.contains(tag),
|
||||
title: tag,
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user