1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-02-28 12:59:50 +00:00

Compare commits

..

4 Commits

Author SHA1 Message Date
Jeremy Ruston
c39e7b44e4 Merge branch 'master' into super-safe-mode 2026-02-25 11:18:59 +00:00
jeremy@jermolene.com
c3ca72ebe2 Add new safe mode layout 2023-03-12 16:05:45 +00:00
jeremy@jermolene.com
1ed3217239 Add delete button to tiddler manager 2023-03-12 16:02:49 +00:00
jeremy@jermolene.com
e59f97b9c5 Add editor panel to tiddler manager 2023-03-12 16:02:30 +00:00
8 changed files with 65 additions and 16 deletions

View File

@@ -1577,6 +1577,8 @@ $tw.Wiki.prototype.processSafeMode = function() {
this.addTiddler(new $tw.Tiddler({title: titleReportTiddler, text: report.join("\n\n")}));
// Set $:/DefaultTiddlers to point to our report
this.addTiddler(new $tw.Tiddler({title: "$:/DefaultTiddlers", text: "[[" + titleReportTiddler + "]]"}));
// Switch to the safe mode layout
this.addTiddler({title: "$:/layout", text: "$:/core/ui/SafeLayout"});
};
/*

View File

@@ -59,6 +59,7 @@ Manager/Controls/Show/Option/Tiddlers: tiddlers
Manager/Controls/Show/Prompt: Show:
Manager/Controls/Sort/Prompt: Sort by:
Manager/Item/Colour: Colour
Manager/Item/Editor: Editor
Manager/Item/Fields: Fields
Manager/Item/Icon/None: (none)
Manager/Item/Icon: Icon

View File

@@ -107,7 +107,7 @@ exports.parseStringLiteral = function(source,pos) {
type: "string",
start: pos
};
var reString = /(?:"""([\s\S]*?)"""|"([^"]*)")|(?:'([^']*)')|\[\[((?:[^\]]|\](?!\]))*)\]\]/y;
var reString = /(?:"""([\s\S]*?)"""|"([^"]*)")|(?:'([^']*)')|\[\[((?:[^\]]|\](?!\]))*)\]\]/g;
reString.lastIndex = pos;
var match = reString.exec(source);
if(match && match.index === pos) {
@@ -221,7 +221,7 @@ exports.parseMacroInvocationAsTransclusion = function(source,pos) {
orderedAttributes: []
};
// Define our regexps
var reVarName = /([^\s>"'=:]+)/y;
var reVarName = /([^\s>"'=:]+)/g;
// Skip whitespace
pos = $tw.utils.skipWhiteSpace(source,pos);
// Look for a double opening angle bracket
@@ -237,11 +237,9 @@ exports.parseMacroInvocationAsTransclusion = function(source,pos) {
}
$tw.utils.addAttributeToParseTreeNode(node,"$variable",token.match[1]);
pos = token.end;
// Check that the tag is terminated by a space or >>, and that there is a closing >> somewhere ahead
if(!(source.charAt(pos) === ">" && source.charAt(pos + 1) === ">") ) {
if(!$tw.utils.parseWhiteSpace(source,pos) || source.indexOf(">>",pos) === -1) {
return null;
}
// Check that the tag is terminated by a space or >>
if(!$tw.utils.parseWhiteSpace(source,pos) && !(source.charAt(pos) === ">" && source.charAt(pos + 1) === ">") ) {
return null;
}
// Process attributes
pos = $tw.utils.parseMacroParametersAsAttributes(node,source,pos);
@@ -269,7 +267,7 @@ exports.parseMVVReferenceAsTransclusion = function(source,pos) {
orderedAttributes: []
};
// Define our regexps
var reVarName = /([^\s>"'=:)]+)/y;
var reVarName = /([^\s>"'=:)]+)/g;
// Skip whitespace
pos = $tw.utils.skipWhiteSpace(source,pos);
// Look for a double opening parenthesis
@@ -325,17 +323,17 @@ exports.parseMacroParameterAsAttribute = function(source,pos) {
start: pos
};
// Define our regexps
var reAttributeName = /([^\/\s>"'`=:]+)/y,
reUnquotedAttribute = /((?:(?:>(?!>))|[^\s>"'])+)/y,
reFilteredValue = /\{\{\{([\S\s]+?)\}\}\}/y,
reIndirectValue = /\{\{([^\}]+)\}\}/y,
reSubstitutedValue = /(?:```([\s\S]*?)```|`([^`]|[\S\s]*?)`)/y;
var reAttributeName = /([^\/\s>"'`=:]+)/g,
reUnquotedAttribute = /((?:(?:>(?!>))|[^\s>"'])+)/g,
reFilteredValue = /\{\{\{([\S\s]+?)\}\}\}/g,
reIndirectValue = /\{\{([^\}]+)\}\}/g,
reSubstitutedValue = /(?:```([\s\S]*?)```|`([^`]|[\S\s]*?)`)/g;
// Skip whitespace
pos = $tw.utils.skipWhiteSpace(source,pos);
// Get the attribute name and the separator token
var nameToken = $tw.utils.parseTokenRegExp(source,pos,reAttributeName),
namePos = nameToken && $tw.utils.skipWhiteSpace(source,nameToken.end),
separatorToken = nameToken && $tw.utils.parseTokenRegExp(source,namePos,/=|:/y),
separatorToken = nameToken && $tw.utils.parseTokenRegExp(source,namePos,/=|:/g),
isNewStyleSeparator = false; // If there is no separator then we don't allow new style values
// If we have a name and a separator then we have a named attribute
if(nameToken && separatorToken) {

View File

@@ -221,7 +221,7 @@ function updateLocationHash(options) {
$tw.utils.copyToClipboard(url,{successNotification: options.successNotification, failureNotification: options.failureNotification});
}
// Only change the location hash if we must, thus avoiding unnecessary onhashchange events
if($tw.utils.getLocationHash() !== $tw.locationHash) {
if($tw.utils.getLocationHash() !== $tw.locationHash && !$tw.safeMode) {
if(options.updateHistory === "yes") {
// Assign the location hash so that history is updated
window.location.hash = $tw.locationHash;

View File

@@ -0,0 +1,5 @@
title: $:/Manager/ItemMain/Editor
tags: $:/tags/Manager/ItemMain
caption: {{$:/language/Manager/Item/Editor}}
<$edit-text tag="textarea" class="tc-edit-texteditor tc-edit-texteditor-body tc-max-width"/>

View File

@@ -13,3 +13,8 @@ caption: {{$:/language/Manager/Item/Tools}}
{{$:/core/images/edit-button}}&#32;edit
</$button>
</p>
<p>
<$button message="tm-delete-tiddler" param=<<currentTiddler>>>
{{$:/core/images/delete-button}}&#32;delete
</$button>
</p>

View File

@@ -0,0 +1,37 @@
title: $:/core/ui/SafeLayout
tags: $:/tags/Layout
name: Safe Mode Layout
description: Safe Mode Layout
icon: $:/core/images/list
\whitespace trim
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
\define tv-config-toolbar-class() tc-btn-invisible
\define tv-config-toolbar-icons() yes
\define tv-config-toolbar-text() no
<div style="margin: 1em;">
<$navigator story="$:/StoryList" history="$:/HistoryList">
<h2>Layout</h2>
{{$:/snippets/LayoutSwitcher}}
<h2>Controls</h2>
<div class="tc-page-controls">
<$list filter="[all[shadows+tiddlers]tag[$:/tags/PageControls]!has[draft.of]]">
<$transclude mode="inline"/>
</$list>
</div>
<h2>Tiddlers</h2>
<$transclude tiddler="$:/Manager" mode="block"/>
</$navigator>
</div>

View File

@@ -1,3 +1,4 @@
title: $:/state/popup/manager/item/$:/Manager/
ItemMain/RawText: hide
ItemMain/RawText: hide
ItemMain/Editor: hide