Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wiki.sortByList should skip an expensive operation when able to #4275

Closed
Arlen22 opened this issue Sep 25, 2019 · 18 comments
Closed

wiki.sortByList should skip an expensive operation when able to #4275

Arlen22 opened this issue Sep 25, 2019 · 18 comments

Comments

@Arlen22
Copy link
Contributor

Arlen22 commented Sep 25, 2019

https://github.com/Jermolene/TiddlyWiki5/blob/e752ba7c6abcdde229258aa1562e6de518c3556e/core/modules/wiki.js#L564-L634

A discussion on Google Groups about a slow wiki led me to this line, which was the culprit for the slowdown for a tag with 36000 titles.

https://github.com/Jermolene/TiddlyWiki5/blob/e752ba7c6abcdde229258aa1562e6de518c3556e/core/modules/wiki.js#L593

I've been studying this function for a half hour, and it suddenly occurred to me that

  • A: if new position is -1 then current position is useless,
  • B: because right now if new position is -1, then it is set to current position
  • C: immediately after that it checks if they are equal and only splices if they are not.

So, in other words, if new position was set to -1, then it will be set to current position, and therefore is equal to it, and therefore prevents a splice from happening. So we could totally optimize this if new position is still -1 after the first group of if statements and just exit the function if there is nothing instead of looking up the current position first.

if(newPos !== -1) {
  var currPos = titles.indexOf(title);
  if(currPos !== -1) {
    titles.splice(currPos, 1);
    if(newPos >= currPos) newPos--;
    titles.splice(newPos, 0, title);
  }
}

Of course, you still can't use list-before and list-after on 36000 tiddlers, but who has ever done that?

@Arlen22
Copy link
Contributor Author

Arlen22 commented Sep 25, 2019

The original discussion is here.

https://groups.google.com/d/msg/tiddlywiki/U1ZKK8UIk94/_URkH-GxAwAJ

@Jermolene
Copy link
Member

Hi @Arlen22 great stuff, thanks for tracking things down. I think it might be helpful to add some tests before we change this. I think the tests would fit best in https://github.com/Jermolene/TiddlyWiki5/blob/master/editions/test/tiddlers/tests/test-utils.js. Might you be able to put together a PR?

@pmario
Copy link
Member

pmario commented Sep 26, 2019

I think the main problem here is, that the tag-operator always does a .sortByList(). ... The "list-field" was introduced at the very beginning of TW development cycle, to get a predictable order for "tagged templates" used with the TW UI.

We rely on the behaviour, because it is convenient.

But I think, it could also be created like this: [tag[test]sortby[list]]

So my proposal would be to create something like a "stripped down" tag-operator, that doesn't do any sorting at all.

This xtag operator may produce unpredictable output order with different browsers, but it would create the fastest possible "speed"

@Arlen22
Copy link
Contributor Author

Arlen22 commented Sep 26, 2019

@Jermolene Sorry, I don't have time right now to do a PR. As far as tests, isn't it enough to determine that the code path is identical by logical reasoning and rearrange the code accordingly? I'm not sure how to test two identical pieces of code. Here is my proposed change again, in case I somehow miscommunicated, interspersed with comments to show my thought process. Basically if newPos is -1, the expensive currPos check is not needed.

Currently:

//get the current position, which we don't yet know
var currPos = titles.indexOf(title); 
//if we have nowhere to move it ...
if(newPos === -1) { 
  //set newPos to currPos
  newPos = currPos; 
} 
//if it is actually in the list (pedantic) and actually needs to be moved ...
if(currPos >= 0 && newPos !== currPos) { 
  //move it!
  titles.splice(currPos,1); 
  if(newPos >= currPos) newPos--; 
  titles.splice(newPos,0,title); 
 } 

Changed to:

//if we have somewhere to move it ...
if(newPos !== -1) {
  //get the current position, which we don't yet know
  var currPos = titles.indexOf(title);
  //if it is currently in the list (pedantic, but appropriate to check) ...
  if(currPos !== -1) {
    //move it!
    titles.splice(currPos, 1);
    if(newPos >= currPos) newPos--;
    titles.splice(newPos, 0, title);
  }
}

@Arlen22
Copy link
Contributor Author

Arlen22 commented Sep 26, 2019

@pmario I think it is very appropriate to use the sortByList function, it's just that we get bogged down if there are list-before or list-after fields on all 36000 tiddlers (after this issue is fixed). Having it on only a few tiddlers does not have the same slow-down. And in the current situation we always get bogged down because of the bug I'm describing. Everything else about the sortByList function is relatively fast and optimized, it seems.

Edit: I just realized you're talking about creating a new operator rather than changing the current operator. We should also create a sortByList operator which would accept any field as the list field argument and sort the input according to that list. That would massively simplify the list field concept. Or has it been done already?

@pmario
Copy link
Member

pmario commented Sep 28, 2019

[tag[test]sortby[list]] should already work

@Arlen22
Copy link
Contributor Author

Arlen22 commented Sep 29, 2019

Does that handle the list field in a special way? If we're going to add a new operator, we should also add a sortByList operator so that any field can be used as a list, not just the list field. But doesn't [tag[test]] work because it calls sortByList in the tag operator? Or is that a different code path?

@Jermolene
Copy link
Member

Hi @Arlen22 I wasn't the author of the current code for sortByList, and I find it pretty hard to follow (the replaceItem() is not helpfully named, for instance!), and I'm not certain that I (a) understand the implications of your proposed changes and (b) can be confident that there are no further worthwhile optimisations. Plus I'm afraid I'm by now highly conservative about unintended consequences of innocuous looking code changes.

@pmario I like the idea of an option for the tag operator to avoid sorting.

@Arlen22
Copy link
Contributor Author

Arlen22 commented Sep 30, 2019

Replace item just makes sure that the tiddler is before the tiddler in the list-before field OR after the tiddler in the list-after field. list-before takes precedence over list-after, and a blank field that exists takes precedence over a field with a tiddler listed. So if list-after exists but is empty, then list-before with a tiddler specified will not take effect, but otherwise list-before takes precedence.

That's the sum of the first part of the replaceItem function. I couldn't find any other optimizations, but this one is major and does not change the final result of the code as best as I can tell.

@Arlen22
Copy link
Contributor Author

Arlen22 commented Sep 30, 2019

All I'm trying to say is that the code reads

  • get current position
  • if new position is -1 set it to current position
  • if current position does not equal new position, do the swap

Since it's expensive to lookup the current position, we should check first if new position is -1 since if it is then it gets set to current position and therefore the swap cannot happen.

I just realized to make the code exactly identical, it should look like this

//if newPos is -1, it will never get moved
if(newPos !== -1) {
  //get the current position, which we don't yet know
  var currPos = titles.indexOf(title);
  //still run the same check on currPos
  if(currPos >= 0 && newPos !== currPos) {
    //move it!
    titles.splice(currPos, 1);
    if(newPos >= currPos) newPos--;
    titles.splice(newPos, 0, title);
  }
}

And the original code again for reference interspersed with my comments.

//get the current position, which we don't yet know
var currPos = titles.indexOf(title); 
//if newPos is not set, set it to currPos
if(newPos === -1) { 
  //set newPos to currPos
  newPos = currPos; 
} 
//if newPos is not equal to currPos (if newPos was -1, then it is always equal)
if(currPos >= 0 && newPos !== currPos) { 
  //move it!
  titles.splice(currPos,1); 
  if(newPos >= currPos) newPos--; 
  titles.splice(newPos,0,title); 
}

I'm not trying to be difficult, I'm just very sure that the actual code is identical, if you're still not convinced, that's fine, I understand.

@Arlen22
Copy link
Contributor Author

Arlen22 commented Sep 30, 2019

I edited my last comment quite a bit, so just letting you know if you're seeing this on email.

@pmario
Copy link
Member

pmario commented Oct 1, 2019

@Arlen22 ... Did you try your changes with the wiki listed at: the original discussion?

@Arlen22
Copy link
Contributor Author

Arlen22 commented Oct 1, 2019

@pmario Good question. I just tried it now, and it does indeed significantly speed up the wiki to pretty much normal when I do the same action I did before and any other actions related to that one filter.

The wiki has other performance problems which are unrelated to this, so I'm continuing to dig into other areas.

@pmario
Copy link
Member

pmario commented Oct 2, 2019

Thank you very much, that you contribute so much valuable time to improve the system!!

@flibbles
Copy link
Contributor

flibbles commented Dec 27, 2019

I am the last person who worked on this method. I understand the change you're proposing, and I concur that it would not change the output. Also, I wrote tests for this back when I modified it to use an internal recursive method. If you look at the PR, I put them in test-tags (cause I was fixing an issue with tag order, but test-utils might make more sense)

Also, I was the one who called it replaceItem, and I guess we can change the name to something practical, like moveItem or placeItemInList.

flibbles added a commit to flibbles/TiddlyWiki5 that referenced this issue Dec 27, 2019
Examined the tests in test-tag. They already cover all the use cases
I could think of.
@flibbles
Copy link
Contributor

This PR should be good to go. Existing tests already ensure that all combinations of list-after and list-before are managed.

Jermolene pushed a commit that referenced this issue Apr 14, 2020
Examined the tests in test-tag. They already cover all the use cases
I could think of.
@flibbles
Copy link
Contributor

This can be closed.

@Arlen22
Copy link
Contributor Author

Arlen22 commented Apr 30, 2020

Looks good to me.

@Arlen22 Arlen22 closed this as completed Apr 30, 2020
telmiger added a commit to telmiger/TiddlyWiki5 that referenced this issue Jun 14, 2020
* Scale embedded videos and audios to fit their container (TiddlyWiki#3943)

* Update videoparser.js

* Update audioparser.js

* Update videoparser.js

* Update audioparser.js

* 2nd attempt to fix overflowing content in vertical tabs

Previously we'd tried to fix it with word-break: break-word, but that broke other things (see 81f1e6a). This overflow: auto approach appears to be best practice.

* Fix newTagNameTiddler being undefined in ControlPanel (TiddlyWiki#4326)

* fix newTagNameTiddler being undefined in ControlPanel

* Update Basics.tid

* prevent newTagNameTiddler being undefined

* Update Basics.tid

* Update tag-picker.tid

* Update tag-picker.tid

* Fix typos in tag-picker (TiddlyWiki#4336)

... sorry @Jermolene

* Replace div with span in colour picker (TiddlyWiki#4333)

* Replace '<<...>>' with a macrocall widget (TiddlyWiki#4346)

... because there is another macrocall inside.

This was introduced by the commit 'Fix sizes of SVG icons in documentation' (SHA: 9395d75) where this probably slipped through in a regular expression replacement session.

I searched through the codebase and the other replacements of this type are ok.

* Correct the jsonstringify documentation (TiddlyWiki#4344)

The jsonstringify substitution table does not list all substitutions, and it listed `'` as being replaced when it's not.  This updates the table based on the code at https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/utils/utils.js#L537

* Add discord to forums tiddler. (TiddlyWiki#4343)

* Syncer: add hidden setting for disabling lazy loading

* Range widget: fix refreshing

The range widget wasn't refreshing correctly when the underlying tiddler value changed

* Comment plugin: Add link to top post

* Fix comment plugin typo

* Improve docs on installing plugins under Node.js

* Add "index" attribute to range widget

* Remove &nbsp from tag pill in edit mode (TiddlyWiki#4366)

* remove &nbsp from tag pill in edit mode

PR: fix missing space between edittemplate tags TiddlyWiki#3585 introduced an unbreakable space ...

The `&nbsp` isn't needed and **causes problems**, if users copy&paste the tag text, because the "new" tag in the text input field now contains an space in front of the tag. This space invalidates the tag, so it doesn't function anymore. 

see [comment in GG](https://groups.google.com/d/msg/tiddlywiki/RQEyqPQIZSM/uaU7lgJJAAAJ) .. I also had a problem like this some time ago, which costed me several hours of debugging.

* Update base.tid

* Update tag.tid

* Signing the CLA (TiddlyWiki#4367)

* Sign the CLA as ento (TiddlyWiki#4222)

* Upgrade to Jasmine 3 (TiddlyWiki#4226)

* process.exit() only exist in a node.js environment

* updateInterval has been removed from upstream

From upstream commit:
jasmine/jasmine@b6eb9a4

* Update Jasmine to 3.4.0

* Reuse the evalInContext helper

* Fix expected parse result to match the actual result

* 'describe' cannot be nested inside 'it' blocks

Jasmine started to explicitly raise an error in these cases since:
jasmine/jasmine#1411

* Be consistent about how to refer to library files

* Update link to Jasmine's official website

* Remove "hack-to-give-us-something-to-compare-against"

It looked messy in the control panel listing.

* Ensure splash screen isn't shown when JS is disabled

* Fix bug with millisecond 0XXX  date format

* Correct fix for bug with millisecond 0XXX date format

Milliseconds need 3 digits, not 4...

* Refactor andtidwiki.js (The saver for Android apps including AndTidWiki, Tiddloid and Tiddloid Lite) (TiddlyWiki#4276)

* Create tiddloid.js

* Update andtidwiki.js

* Delete tiddloid.js

* Update andtidwiki.js

* Update andtidwiki.js

* Update andtidwiki.js

* Update andtidwiki.js

* Update andtidwiki.js

* Update andtidwiki.js

* Add Elixir to languages supported by Highlight plugin

Fixes TiddlyWiki#4378

* Slight optimisation of $tw.utils.addClass()

* Fix wiki referenced by navigator widget's rename tiddler handler

* Make the single window template compatible with the page template

The tv-* variables were missing, making toolbar buttons appear incorrectly. There was also no tc-page-container class.

Fixes TiddlyWiki#4372

* Avoid setting an explicit colour in the new-journal-button icon

This change means that the colour for the date on the new journal button icon will change according to the current colour palette, and simplifies things for TiddlyWiki#4379

* Add script to optimise SVGs

Fixes TiddlyWiki#4379. Optimised SVGs in the next commit

* Optimised SVG icons

* Remove extraneous paths from line-width and list icons

Fixes TiddlyWiki#4369 and TiddlyWiki#4368

* Update docs for "each" filter

* Signing the CLA (TiddlyWiki#4387)

* Update links to Json Mangler plugin github pages (TiddlyWiki#4388)

The plugin's repo appears to have been renamed.

* Tweak docs for each filter

* Fix tests in tiddlywiki-com branch by forcing an older version of node.js

* Another attempt to force Travis to use an old Node.js

Another attempt at 55ed290

* Update class settings in edit template to match view template

@pmario this adds the tc-tagged- classes to the edit template, do you think that's useful?

* Update tests (TiddlyWiki#4392)

add 3 new tiddlers, add 1 "enlist" test, fix all tests that failed, because 3 new tiddlers where added. stopped ESLint to complain about global vars, fix some mixed-tab-space indent typos.

* Updated Portuguese Translation

See https://groups.google.com/d/msg/tiddlywiki/esj5IB935oo/xS-F9n5FBAAJ

* Fix bug with importvariables and empty set widgets

A self-closing set widget doesn't have a "children" property.

* Add support for $:/tags/Macro/View macros that are only visible within view templates

* Initial commit of freelinks plugin

* It's 2020!

* Update TiddlyFox docs

Fixes TiddlyWiki#4399

* Fix "remove" tooltip in keyboard shortcuts (TiddlyWiki#4405)

this PR just fixes the tooltip of the small "remove" button in the keyboard-shortcut dropdown

* Signing the CLA (TiddlyWiki#4403)

* Add support for file type webm & ogg theora (TiddlyWiki#4404)

* Add a faint background to freelinks

* Don't freelink within links and buttons

* Restore whitespace for page control buttons

Even with whitespace trim, we need a single space between the icon and text

* Freelinks: Add note about customising within which tiddlers are freelinked

* Replace "&times" with close-button in keyboard-shortcuts (TiddlyWiki#4406)

this PR replaces the `&times` in the keyboard-shortcuts dropdown with the `$:/core/images/close-button`

* Use match operator instead of prefix

Fixes TiddlyWiki#4407

* Add a new example that shows using all before to determine the nummeric position of a title in a list. (TiddlyWiki#4412)

See discussion https://groups.google.com/forum/?hl=en#!topic/tiddlywiki/wY6haW2cYMA

* Fix stamp dropdown not transcluding caption field

* Replace Markdown parsing library with Remarkable (TiddlyWiki#3876)

* Replace Markdown parsing library with Remarkable

* Fix handling of block-level elements

* Update documentation

* Add config options for Parser actions

* Add Config options for Remarkable library

* Match code style

* Update documentation

* Handle ordered lists and horizontal rules

* Update to v2.0.0 of Remarkable library

* Fix bug with navigating via location hash

Introduced in 8159c4a, the problem was that it is actually valid for storyTitle and/or historyTitle to be falsey in the Story constructor.

* Introduction edition: fix some display issues

Two of the tiddlers incorporate content dynamically drawn from the core, and so the size of the tiddlers has increased as the core has grown.

* Docs: Update length Operator.tid (TiddlyWiki#4428)

* Docs: Update sign Operator.tid (TiddlyWiki#4426)

* Railroad plugin: Use message box colours so that they change with the palette

* Docs: fix typos and font-size (TiddlyWiki#2795)

* Docs:  bring tm-fold-xxx message docs on par with the code, that is executed. (TiddlyWiki#4353)

* Changed importVariable to store its own variables (TiddlyWiki#4108)

* Changed importVariable to store its ownvariables

Before, importVariables was creating a setWidget for every single variable it would find in its tiddlers, and it would create a long-ass call tree. Now, instead, it just accumulates the variables in itself.

* Can't use Object.assign

Learned the hardway while working on tw5-relink that Object.assign
doesn't exist in IE11. Using $tw.utils.extend instead.

* Retaining setWidget transclusion flexibility

* One more test to verify mixing sets and macros

* Make "type" input look consistent with "fields" input (TiddlyWiki#4358)

* add class tc-edit-texteditor to type field, trim ...

... whitespace, make look consistent

* define width 20% for type input field

* add second nbsp; for consistency with type input

* Add whitespace trims to tag-picker macro (TiddlyWiki#4360)

* Add optional storyview to list-tagged-draggable macro (TiddlyWiki#4329)

* add optional storyview to list-tagged-draggable macro

* Update list.tid

* Add "none" as an option in the icon dropdown in tag manager (TiddlyWiki#4361)

* add no-icon option to tagmanager and add ...

... whitespace trims

* Update Misc.multids

* Signing the CLA (TiddlyWiki#4424)

* Ensure GitHub and GitLab savers use a default path of `/` if empty

The empty string gets a slash appended further down this method.

* Add download button/link to binary tiddler warning banners in view and edit mode (TiddlyWiki#4423)

* Fix support for zip files in some environments (TiddlyWiki#4432)

In some environments (at least on my own machine), TiddlyWiki detects zip files as type `"application/x-zip-compressed"` instead of `"application/zip"`. This commit adds support for zip files with type `"application/x-zip-compressed"` so that they are encoded in `"base64"` like other zip files with type `"application/zip"`.

* More listops tests (TiddlyWiki#4409)

* add a new-line before the log text to increase readability of the test output

* make eslint, jslint happy

* make eslint happy

* add more listops tests

* new listops filter tests

* remove new-line

* make eslint happier.

* revert eslint settings

* Docs: Fix typos in button widget docs

* Docs: Update ViewWidget.tid (TiddlyWiki#4437)

* Update chinese translations (TiddlyWiki#4325)

* Update chinese translations
* Imporve chinese translations for UI of basic tab in controlpanel
* Add chinese translations for description of throttle.refresh field

* Add chinese translations for the `none` option of icon dropdown in tag manager

* Extend jsontiddlers macro to generate unformatted output

* First attempt at sharing plugin/edition

* Include share.html in the main build

* Fix path.posix.sep which appears to be undefined on Travis CI

* Fix Travis CI syntax error

We were getting "SyntaxError: Use of const in strict mode."

* Temporarily remove markdown plugin from prerelease

It's giving errors under Travis CI

* Travis CI: Move to Node.js 12

Apparently the default Node 10 doesn't include Math.trunc()

* Travis CI: Try deleting and recreating .travis.yml

It appears to have worked for some people c.f. stackoverflow

* Travis CI: Add .travis.yml back again

* Travis CI: Another attempt to fix things

Seems that I don't understand YAML

* Share: Exclude the $:/build tiddler

* Share plugin: Improve startup error handling

* Add tabindex support to button widgets (TiddlyWiki#4442)

This pull request adds support for specifying a tabindex for button widgets following the same pattern as the LinkWidget.

* Signing the CLA (TiddlyWiki#4447)

* Share plugin: Add warning prompt

* Update release note

Better late than never

* Browser-storage plugin: Don't save popup state by default

* Update documentation for tabindex support for ButtonWidget (TiddlyWiki#4465)

Documentation for changes introduced in TiddlyWiki#4442

* Share plugin: Add prominent warning in readme

* Enhance colour macro with a fallback to a configuration tiddler

* First commit of new Menu Bar plugin

* Tweak some system buttons to look better in the new menu bar

The reveal widget leaves behind an unnecessary span, which breaks the CSS used to target the button.

* Disable sticky titles for the prerelease

Sadly, they don't play nicely with the new menu bar

* Update release note

* Menubar tweaks

* Fix old references to "top menu" to the new "menu bar" terminology
* Use vanilla breakpoint for responsive adjustment to menu bar padding

* Push top right menu items to the right

Looking more backwards compatible

* Menubar: Reverse order of top right menu items

* Prerelease: Disable browser storage to make testing less confusing

* Fix broken filters introduced in b179a60

The mistake arose because browser local storage was enabled

* Signing the CLA (TiddlyWiki#4440)

* Markdown plugin: Description notes remarkable instead of markdown-js (TiddlyWiki#4422)

* Add action-popup widget

Fixes TiddlyWiki#4185

* Add hidden setting for default tiddler icon

* Fix test for needing to update text editor DOM

Checking the active element is clumsy, and interferes with debugging. Checking the content is clearer, and avoids the Firefox bug.

Fixes TiddlyWiki#4472

* Fix lack of refresh when button widget actions attribute changes

* ViewTemplate: Add tc-tiddler-overridden-shadow class

* Remove unsafe externalimages build target from server edition

See TiddlyWiki#4484

* Fix suspected typo that impacts refresh handling (TiddlyWiki#4464)

* Add menubar-background and menubar-foreground to Nord palette (TiddlyWiki#4482)

Nord palette

* Add color descriptions for menubar-background and ... (TiddlyWiki#4481)

menubar-foreground to PaletteColours.multids

* Mention importing process more explicitly (TiddlyWiki#3666)

* Mention importing process more explicitly

* Explicitly mention "images"

So this page shows up in a search for "images".

* Apply PR suggestions

* Add chinese translations for color descriptions for menubar-background and menubar-foreground (TiddlyWiki#4488)

* Introducing "Dynannotate" plugin for overlaying annotations

* Clarify docs on the path-prefix subcommand of the listen command

* Update LinkWidget.tid (TiddlyWiki#4489)

* Add german descriptions for menubar-background... (TiddlyWiki#4483)

* add german descriptions for menubar-background...

* Update PaletteColours.multids

* Update PaletteColours.multids

* Better readability for "Community" Tiddler with various ... (TiddlyWiki#4493)

... color palettes

* Signing the CLA (TiddlyWiki#4492)

* Added gitea saver (TiddlyWiki#4491)

* added gitea saver

* create nonexistent file

* Add "Gruvbox Dark" color palette (TiddlyWiki#4494)

* Add "Gruvbox Dark" color palette

this adds the "gruvbox dark" color palette (https://github.com/morhetz/gruvbox) which is also available for highlight.js and codemirror

* add "credits" field

* change "credits" field to "license" field

* Add support for a custom class to modal wrapper (TiddlyWiki#4490)

* Add support for a custom class to modal wrapper

As per TiddlyWiki#4485 add support for a custom class to modal wrapper, by means of a field in the modal tiddler. The class is added to the modal wrapper in addition to the default class, allowing for custom styling via css of any part of the modal.

* Remove redundant check for tiddler.

* Menubar: Move behind modals in z-order

Fixes TiddlyWiki#4499

* Add chinese translations for description of Gitea saver (TiddlyWiki#4498)

* Menubar: Move behind modals in z-order

Fixed fix for TiddlyWiki#4499

* Use CamelCase for Gitea (TiddlyWiki#4496)

* Menubar: Add an optional dropdown for the sidebar tabs

* Update highlight.js to latest v9.18.1 (TiddlyWiki#4502)

* update highlight.pack.js to latest v9.18.1

* Update readme.tid

* Update GruvBoxDark.tid (TiddlyWiki#4501)

* Menubar: Fix links in sidebar "open" tab

Fixes @BurningTreeC's report TiddlyWiki@061a2c6#commitcomment-37826117

* Highlight Plugin: Update readme to reflect version change (TiddlyWiki#4503)

* Revert "Fix test for needing to update text editor DOM"

This reverts commit a65ec87.

* Add a hidden setting for disabling the page dropzone

* Menu bar: Fix search result visibility

Fixes TiddlyWiki#4509

* Update GruvBoxDark.tid (TiddlyWiki#4510)

better readability, was wrong the first time

* Fix the index names of chinese translations for Gitea saver in ControlPanel.multids (TiddlyWiki#4506)

* Docs: Clarify Node.js docs

* Fixes issue with TiddlyWiki#4504 and importvariable copying (TiddlyWiki#4518)

* Fixes issue with TiddlyWiki#4504 and importvariable copying

ImportVariables widget was using $tw.utils.extend to copy the
variables from temporary set widgets into itself. However,
$tw.utils.extend does NOT behave like Object.assign. It not only
copies all self-owned variables over, but also all variables
in that object's prototype chain. This led to some redundant copying,
and a problem where some variables might show up more than once
(like transclusion).

Fixed now. importvariables widget does its own copying, since it
can't rely on $tw.utils.extend to do the right job, and it can't
count on Object.assign to be there.

* Added test to prevent reversion of TiddlyWiki#4504

* Slight corrections to new importvariables test

* Improve ability to disable drag and drop

Now we disable the draggable list macros too.

* Update docs for disabling drag and drop

* Update Nord Palette for better readability (TiddlyWiki#4517)

* Update Vanilla.tid (TiddlyWiki#4515)

* Menubar: Fix positioning of toprightbar when narrow

Fixes TiddlyWiki#4477

* Add backlinks indexer (TiddlyWiki#4421)

* Add tests for backlinks

* Add backlinks indexer

* Use backlinks indexer in getTiddlerBacklinks if available

* Extract link extraction into its own method

This way we can provide an arbitrary parse tree, rather than just a
title, which will allow us to compare lists of outgoing links between
versions of a single tiddler

* Use new extractLinks method in backlinks indexer

...rather than copy-pasting the implementation

* Remove ES6-isms

TiddlyWiki needs to work with browsers that only support ES5

* GruvBoxDark palette contrast tweaks (TiddlyWiki#4522)

* Fix the datauri macro to work with _canonical_uri tiddlers

* Update release note

* Fix syncer to handler errors properly (TiddlyWiki#4373)

* First commit

* Add throttling of saves

Now we refuse to save a tiddler more often than once per second.

* Wait for a timeout before trying again after an error

* Modest optimisations of isDirty() method

* Synchronise system tiddlers and deletions from the server

Fixes two long-standing issues:

* Changes to system tiddlers are not synchronised from the server to the browser
* Deletions of tiddlers on the server are not propagated to browser clients

* Make sure we update the dirty status even if there isn't a task to perform

* Replace save-wiki button with popup sync menu

* Remove the "Server" control panel tab

We don't need it with the enhanced sync dropdown

* Add indentation to the save-wiki button

* Fix spacing in dropdown menu items

* Switch between cloud icons according to dirty status

* Add a menu item to copy syncer logs to the clipboard

* Improve animated icon

* Remove indentation from save-wiki button

@pmario the annoying thing is that using `\trim whitespace` trims significant whitespace too, so it means we have to use <$text text=" "/> when we need a space that won't be trimmed. For the moment, I've removed the indentation but will keep thinking about it.

* Further icon, UI and copy text tweaks

Move the icons and styles from the core into the TiddlyWeb plugin

* Clean up PR diff

* Tweak animation durations

* Break the actions from the syncer dropdown into separate tiddlers

@pmario I think this makes things a bit easier to follow

* Refactor syncadaptor creation and logging

The goal is for the syncadaptor to be able to log to the same logger as the syncer, so that the "copy syncer logs to clipboard" data is more useful.

* Don't transition the dirty indicator container colour, just the SVG's colour

* Only trigger a sync for changes to tiddlers we're interested in

Otherwise it is triggered by the creation of the alert tiddlers used to display errors.

* Restore deleting local tiddlers removed from the server

(I had commented it out for some testing and accidentally commited it).

* Guard against missing adaptor info

* We still need to trigger a timeout when there was no task to process

* Avoid repeatedly polling for changes

Instead we only trigger a timeout call at if there is a pending task (ie a tiddler that has changed but isn't yet old enough to save).

* Lazy loading: include skinny versions of lazily loaded tiddlers in the index.html

* Introduce _is_skinny field for indicating that a tiddler is subject to lazy loading

* Remove savetrail plugin from prerelease

It doesn't yet work with the new syncer

* Make the savetrail plugin work again

* Clear outstanding alerts when synchronisation is restored

* Logger: only remove alerts from the same component

Missed off 9f5c0de

* Make the saving throttle interval configurable (TiddlyWiki#4385)

After switching Bob to use the core syncer the throttle interval makes saving feel very sluggish compared to the message queue setup that I had before.
The editing lock that I use to prevent conflicts with multiple users doesn't go away until the save is completed, and with the 1 second delay it means that if you edit a tiddler and save it than you have to wait one second before you can edit it again.

* Tweaks to appearance of alerts

* Exclude temp tiddlers from offline snapshots

Otherwise alerts will persist

* Tweak appearance of status line in dropdown

* Update release note

* Web server: Don't include full path in error messages

Fixes TiddlyWiki#3724

* In change event handler check for deletions

* Disable the official plugin library when the tiddlyweb plugin is loaded

* Hide error details from browser for /files/ route

See TiddlyWiki#3724 (comment) -- thanks @pmario

* Revert all the changes to the relationship between the syncer and the syncadaptor

Previously we had some major rearrangements to make it possible for the syncadaptor to route it's logging to the logger used by the syncer. The motivation is so that the "copy logs to clipboard" button is more useful.

On reflection, changing the interface this drastically is undesirable from a backwards compatibility perspective, so I'm going to investigate other ways to achieve the logger sharing

* Make the tiddlyweb adaptor use the syncer's logger

So that both are availavble when copying the syncer logs to the clipboard

* Update release note

* Support setting port=0 to get an OS assigned port

Quite useful

* Update code comment

* UI: Use "Get latest changes from server" instead of "Refresh"

* Add getUpdatedTiddlers() method to syncadaptor API

See TiddlyWiki#4373 (comment)

* Refactor revision handling within the syncer

Thanks @pmario

* Fix typo in tiddlywebadaptor

* Improve presentation of errors

See TiddlyWiki#4373 (comment)

* Add docs for getTiddlerRevision()

* Remove unused error animation

* Update comment for GET /recipes/default/tiddlers/tiddlers.json

* Optimise SVG cloud image

* Add optional list of allowed filters for get all tiddlers route

An attempt to address @Arlen22's concern here:

TiddlyWiki#4373 (review)

* Fix network error alert text translatability

* Fix error code and logging for GET /recipes/default/tiddlers/tiddlers.json

Thanks @Arlen22

* Flip GET /recipes/default/tiddlers/tiddlers.json allowed filter handling to be secure by default

* Validate updates received from getUpdatedTiddlers()

* Add syncer method to force loading of a tiddler from the server

* Remove the release note update to remove the merge conflict

* Fix crash when there's no config section in the tiddlywiki.info file

* Use config tiddler title to check filter query (merge into fix-syncer) (TiddlyWiki#4478)

* Use config tiddler title to check filter query

* Create config-tiddlers-filter.tid

* Add config switch to enable all filters on GET /recipes/default/tiddlers/tiddlers.json

And update docs

* Fix bug when deleting a tiddler with a shadow

Reported by @kookma at TiddlyWiki#4373 (comment)

Co-authored-by: jed <inmysocks@fastmail.com>
Co-authored-by: Arlen22 <arlenbee@gmail.com>

* Updates for Dutch translation

Thanks @gernert

* Fix ActionPopupWidget example

Thanks @twMat

The example had been written while there was a bug that changed the state tiddler titles used by the sidebar

* Update syncer to distinguish connection errors from other errors

We can automatically remove connection errors when things resume working

* Update chinese translations (TiddlyWiki#4528)

* add description of field `_is_skinny`
* add alert message `Error/NetworkErrorAlert`

* TiddlyWebAdaptor: Trim whitespace from save button

Fixes TiddlyWiki#4530

* Update release note

* Fix release note typo

* Add TiddlyDesktop's wikilist colours to Gruvbox palette (TiddlyWiki#4521)

* Update documentation for Modals (TiddlyWiki#4495)

Update documentation for modals to include the custom class introduced in TiddlyWiki#4485, as well as the footer and subtitle fields that don't appear to be documented.

* Add "class" attribute to dropzone widget

* Fix range widget for IE10/11 (TiddlyWiki#4534)

As detailed in TiddlyWiki#4519 the range widget currently does not save its value to the state tiddler on IE 10/11 as they do not support the input event, but rather the change event is fired instead of the input event. This has patch has been tested in IE11 and should work in IE10 as well.

Note that on Chrome and Firefox, the change event will fire only once after the user stops dragging the range slider (In addition the input event). However this does lead to an extra refresh as the handleInputEvent method already checks to see if the current value of the slider is different from the saved value before saving to the store.

* fr-FR translations catch up (TiddlyWiki#4535)

* fr-FR translated strings for the Gitea saver

* fr-FR translation for the _is_skinny description

* fr-FR translation for the Network Error alert

* fr-FR translation for Menu Bar colors

* fr-FR translation for the hint of the add button in EditTemplate

* fr-FR translation for the default focus field hint

* fr-FR translation for throttle.refresh field description

* fr-FR translation for Icon: None in TagManager

* fr-FR translation for Plugins "Also requires:"

* Add NewJournalTags.tid in fr-FR directory

* fr-FR translations for plugin related strings

* fr-FR translation for Sidebar visibility toggle hint

* fr-FR translation for the sidebar search hint

* fr-FR translation for two Palette Editor hints

* Minor tweaks to plugin library listings

* Adds a name to the core plugin
* Make plugin listings consistently show "name: description"
* Make plugin listings consistently sort by title (thus grouping publishers)
* Add a missing plugin name

See discussion here: TiddlyWiki#4508 (comment)

* Travis-CI: Fix nvm failing to install Node.js v12.4.0

Something must have changed on the travis-ci end to cause things to suddenly fail

* Update German translations (TiddlyWiki#4539)

* add a new-line before the log text to increase readability of the test output

* make eslint, jslint happy

* it shouldn't be there

* fremove this file from my PRs

* update German translations

* Add support for woff2 files

* Signing the CLA (TiddlyWiki#4235)

Co-authored-by: Jeremy Ruston <jeremy@jermolene.com>

* Update issue templates

* Add pull request template

* Docs: fix broken link

Fixes TiddlyWiki#4266

* Add dependents to codemirror addons (TiddlyWiki#4278)

* use dependents in codemirror-autocomplete

* add dependents to codemirror-mode-htmlmixed

* add dependents to sublime keymap

* add dependents to vim keymap

* add dependents to htmlmixed mode

* add dependents to htmlembedded mode

* add dependents to markdown mode

* fix typo in markdown-mode

* fix typo in codemirror-mode-htmlembedded

* fix typo in codemirror-keymap-sublime

* fix typo in codemirror-keymap-vim

* fix typo in codemirror-mode-htmlembedded

* fix typo in codemirror-mode-markdown

* Let chained `>` blockquotes generate valid HTML (TiddlyWiki#4332)

* Replace "p" with "div" in itemTag

'>> text' will now be valid html.

* Make the new div's behave like p's

* Enable the internals plugin by default in docs (TiddlyWiki#4335)

* Enable the internals plugin by default in docs

1. Why hide such a useful thing from the users?

2. When playing around with code examples from the docs they may want to know how the resulting html looks.

* Improve doc

* Typo

Co-authored-by: Jeremy Ruston <jeremy@jermolene.com>

* Update jsonstringify Operator.tid (TiddlyWiki#4348)

* Enable indexers in tag test (TiddlyWiki#4355)

Setting enableIndexers to an empty array ends up disabling all indexers
for the wiki

* Fix missing comma in editions/tw5.com/tiddlywiki.info

* New release banner

Congratulations @telmiger

* Remove internal version number info from dynnannotate plugin

* Fix count widget to return "0" for an empty filter string instead of undefined

* AddPlugins: Add a clearer prompt for plugins that have subplugins

* AddPlugins: Add new "updates" tab

* Release note update

* Add new compare filter operator

Fixes TiddlyWiki#4554

* Plugin Chooser: Include currently installed version

* Plugin Chooser: Distinguish between install, reinstall, update and downgrade

* Release note update

* Plugin Chooser: Use existing template for updates tab

* Release note update

* Additional fr-FR translation for Control Panel  (TiddlyWiki#4555)

* fr-FR translation for strings relative to plugin updates

* Missing fr-FR translation for a string in ControlPanel

* Missing fr-FR translation for Copy to Clipboard caption & hint

* Missing fr-FR translations for the Edit Template

* fr-FR translations for updates/upgrades in plugin chooser

* Add chinese translations for AddPlugins things (TiddlyWiki#4546)

* Add chinese translations for AddPlugins things
* "updates" tab
* prompt for plugins that have subplugins

* Improve chinese wording

* Update chinese translations for AddPlugins
* add Plugins/Downgrade/Caption
* add Plugins/Update/Caption
* update Plugins/Updates/UpdateAll/Caption

* Plugin Chooser: Use separate tab state for each plugin library

Fixing the third issue at TiddlyWiki#4486 (comment) from @kookma

* Plugin Chooser: Don't display the "already installed" message twice

Fixing the first issue here TiddlyWiki#4486 (comment) by @kookma

* Plugin Chooser: Colour of update all button should match individual update buttons

Fixes the final issue mentioned by @kookma at TiddlyWiki#4486 (comment)

* Plugin Chooser: Ensure official plugin library is shown first

* Control Panel Plugin Listing: Fallback to last component of title if name field is missing

* Fix makelibrary.js to use enviroment variable paths (TiddlyWiki#4559)

This makes makelibrary.js use environment variables to find paths for plugins, themes and languages instead of just using the paths hardcoded in boot.js

* Makelibrary.js: Minor refactoring

* Update copyright date in license

* Add has:index (TiddlyWiki#4540)

* has:index

* has:index

* has:index docs

* has op examples

* has op examples

* operator macros typo missing </div>

* possible mistake

* Update RangeWidget.tid (TiddlyWiki#4453)

* Update RevealWidget.tid (TiddlyWiki#4451)

* Update ViewWidget.tid (TiddlyWiki#4441)

ref TiddlyWiki#4438

* fix the example path (TiddlyWiki#4419)

* Reduced indexOf calls in wiki.sortByList (TiddlyWiki#4275) (TiddlyWiki#4397)

Examined the tests in test-tag. They already cover all the use cases
I could think of.

* Fixed join filter operator to never returns null (TiddlyWiki#4396)

If the operator were passed an empty list, it would return null
which could cause some proceeding operators to crash.

* Add Mandar Vaze to Individual Contrib. Agreement (TiddlyWiki#4543)

* Add details about special tag in usage for ribbon (TiddlyWiki#4544)

Resolve TiddlyWiki#2581

* Signing the CLA to start contributing (TiddlyWiki#4562)

My Chinese name is Lin Dongwu, I will use that to sign it.

* Fix: z-index for codemirror hint not large enough (TiddlyWiki#4551)

It is currently covered by other tiddler.

* Fix link

* Update release note

* Plugin Chooser: Display libraries as separate tabs

Suggested by @kookma

* Fix wrong configurations in `tiddlywiki.info` for editions `zh-Hant` and `zh-Hans` (TiddlyWiki#4564)

* Remove unwanted whitespace from sidebar links (TiddlyWiki#4552)

* add a new-line before the log text to increase readability of the test output

* make eslint, jslint happy

* it shouldn't be there

* fremove this file from my PRs

* fix 4532. Links should not add unwanted whitespace, since this causes problems with CSS styling

* remove whitespace from tiddler title and add a little bit of margin-right to the tiddler icon.

* use default parameters for link handling, which results in less code

* introduce tc-viewswitcher class to be able to style icon distance to text

* Add new parameters to fields-widget and fields-operator. (TiddlyWiki#4433)

* add a new-line before the log text to increase readability of the test output

* make eslint, jslint happy

* extend fields-widget with include/exclude/sort/reverse and fields-filter with include and exclude params plus DOCS

* remove new-line

* remove eslint settings

* restore old eslint settings

* remove typo

* jsontiddlers macro: parse "spaces" parameter as integer

* Utils: ParseInt should specify a radix

Thanks @pmario

* Action create tiddler improvements (TiddlyWiki#4436)

* add a new-line before the log text to increase readability of the test output

* make eslint, jslint happy

* add $template and $overwrite parameter

* documentation for new parameters + 4 new examples

* remove unwanted files

* Release note update

* Preparing for v5.1.22 release

* Update readme for v5.1.22

* Version number update for 5.1.22

* Add Product Hunt badge

* Signing the CLA (TiddlyWiki#4581)

* Fix broken links in static rendering

Fixes TiddlyWiki#4577

* Make commands for static generation more complete (TiddlyWiki#4588)

* Make commands for static generation more complete

* Added message about installing on node.js

* Update information about Quine for iOS

* Update cla-individual.md (TiddlyWiki#4607)

* Add Nicolas Petton to the list of contributors (TiddlyWiki#4617)

Co-authored-by: Jeremy Ruston <jeremy@jermolene.com>

* Docs updates and fixing broken links (TiddlyWiki#4628)

* Corecting URL of LuckySushi shop

* Android-Instructions remained for Andtidwiki

* Updating description and feature set of Timimi
Updating URL of Widdly
Resolving minor camelcase issues in TiddlySpot

* Detailed instructions about termux and adding it to save methods

* Correcting the words "open source" and "Unix"

* Changing link protocols of verified domains to https

* Fix mailto links Forums.tid (TiddlyWiki#4616)

To avoid users being mislead when trying to subscribe by email to one of the
Google Groups, put only the relevant mailto link in each forum section.

Co-authored-by: Jeremy Ruston <jeremy@jermolene.com>

* Clarify Introduction to filter notation.tid (TiddlyWiki#4639)

I'm reading the documentation for the first time and I'm trying to clarify parts which are hard to understand for first-time users.

* Update Generating Static Sites with TiddlyWiki.tid (TiddlyWiki#4636)

* Update rendertiddlers.tid (TiddlyWiki#4635)

* Update RoadMap tiddler

Fixes TiddlyWiki#4661

* Update How to apply custom styles.tid (TiddlyWiki#4663)

* Update TiddlyWiki in the Sky for TiddlyWeb (TiddlyWiki#4667)

remove refs to TiddlySpace

* Update LinkWidget.tid (TiddlyWiki#4690)

add image link

* Update Images in WikiText.tid (TiddlyWiki#4691)

* Update KeyboardWidget.tid (TiddlyWiki#4606)

Add railroad for key strings.

* Update Saving on a PHP Server.tid (TiddlyWiki#4714)

As suggested by @Marxsal

* Visual changes to Saving Tiddler (TiddlyWiki#4640)

* Styles and templates for visual changes to Saving methods listing

* Color coding saver methods according to delivery

* Changes to tags and few tiddlers
- The tag InternetExplorer has been changed to [[Internet Explorer]]
- A tag for Edge is added
- Reclassified TiddlyServer as DIY instead of App
The existing criteriion for classification is unclear. Here is my reasoning for the change. An app is something user can simply install and run. Like TiddlyDesktop or Tiddloid. A DIY is something user has to install additional runtimes for. Thus Nodejs is a DIY. In the same vein, TiddlyServer is a DIY

* Adding Twexe

* Reversing accidental changes to StoryList

* Restyling Download button and Card Size

* Removing "Read more" links

Entire card is now clickable
To give visual clues regarding the clickability of card, title will change color to blue on card hover

* Removing margins from elements under link and adding padding instead.

Why this change? Margins are not "clickable". Having margins under <a> tag means there are minute dead areas where the mouse pointer will change shape, is not clickable and degrade user experience. Paddings are "clickable"

Co-authored-by: donmor <donmor3000@hotmail.com>
Co-authored-by: Jeremy Ruston <jeremy@jermolene.com>
Co-authored-by: Simon Huber <huber.simon@protonmail.com>
Co-authored-by: Nils-Hero Lindemann <nilsherolindemann@gmail.com>
Co-authored-by: Matt Lauber <github@mklauber.com>
Co-authored-by: Mario Pietsch <pmariojo@gmail.com>
Co-authored-by: Xavier Maysonnave <x.maysonnave@gmail.com>
Co-authored-by: Marica Odagaki <ento.entotto@gmail.com>
Co-authored-by: Will Atwood Mitchell <wam@users.noreply.github.com>
Co-authored-by: Stefan Krüger <git@s-light.eu>
Co-authored-by: TonyM <31584658+AnthonyMuscio@users.noreply.github.com>
Co-authored-by: Brooks Boyd <MidnightLightning@users.noreply.github.com>
Co-authored-by: twMat <boardsmm@gmail.com>
Co-authored-by: Cameron Fischer <fischer.cameron@gmail.com>
Co-authored-by: Lee Sheng Long <github@sll.ee>
Co-authored-by: Bram Chen <bram.chen@gmail.com>
Co-authored-by: saqimtiaz <saq.imtiaz@gmail.com>
Co-authored-by: lucible <45129600+lucible@users.noreply.github.com>
Co-authored-by: scott willeke <scott@willeke.com>
Co-authored-by: JesseWeinstein <jesse@wefu.org>
Co-authored-by: Matthias Bilger <matthias@bilger.info>
Co-authored-by: Rob Hoelz <rob@hoelz.ro>
Co-authored-by: Joshua Fontany <joshua.fontany@gmail.com>
Co-authored-by: jed <inmysocks@fastmail.com>
Co-authored-by: Arlen22 <arlenbee@gmail.com>
Co-authored-by: Xavier Cazin <xavier@cazin.eu>
Co-authored-by: Mohammad Rahmani <830394+kookma@users.noreply.github.com>
Co-authored-by: Mandar Vaze <mandarvaze@gmail.com>
Co-authored-by: lin onetwo <linonetwo012@gmail.com>
Co-authored-by: idotobi <16611056+idotobi@users.noreply.github.com>
Co-authored-by: Marxsal <throaway@yahoo.com>
Co-authored-by: mocsa <13969648+mocsa@users.noreply.github.com>
Co-authored-by: Nicolas Petton <nicolas@petton.fr>
Co-authored-by: Rizwan <ibnishak@live.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants