1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-26 03:27:18 +00:00
Commit Graph

315 Commits

Author SHA1 Message Date
Jeremy Ruston
cbd07465f3 Fix test rig shadow tiddler behaviour
The test rig previously used a simplified implementation of shadow tiddlers which broke with the new indexing engine. There was also a problem that made that even if indexers were disabled they were still initialised.

This PR fixes both problems, in preparation for fixing #4082
2019-07-16 16:53:37 +01:00
Jeremy Ruston
a8f70b08a8
Add indexes to the wiki store to improve performance (#3951)
* First pass at modular wiki indexes

An exploratory experiment

* Fix tests

* Faster checking for existence of index methods

We don't really need to check the type

* Use the index for the has operator

* Fix typo

* Move iterator index methods into indexer modules

Now boot.js doesn't know the core indexers

* Fix up the other iterator index functions

* Fix crash with missing index branch

* Limit the field indexer to values less than 128 characters

* Fallback to the old manual scan if the index method returns null
* Sadly, we can no longe re-use the field indexer to accelerate the `has` operator, because the index now omits tiddlers that have field values longer than the limit

Still need to make the index configuration exposed somehow

* Rearrange tests so that we can test with and without indexers

We also need to expose the list of enabled indexers as a config option

* Test the field indexer with different length fields

So that we test the indexed and non-indexed codepaths
2019-05-24 21:07:37 +01:00
Jeremy Ruston
feab75a6d1 Add support for preloading plugins by path instead of name 2019-05-24 12:06:11 +01:00
Jermolene
edd3156430 Improve loading/importing of JSON files
First part of fix for #3875

The idea is to do a better of job of distinguishing JSON files that contain tiddlers versus those that contain plain blobs of JSON that should be stored as a single application/json tiddler.

Under Node.js, .json files with an accompanying metafile are always treated as a JSON blob. Without a meta file, those that appear to not contain valid tiddlers are returned as a JSON blob, otherwise the tiddlers within the file are imported.

In the browser, we don't have .meta files so we rely on the valid tiddler check.
2019-04-13 14:47:27 +01:00
Jermolene
8c72a28f0c Add ability to load plugins via the command line
Fixes #3907
2019-04-12 18:09:16 +01:00
Jermolene
70f5dff81e Add a boot hook for modifying the tiddler store 2019-02-03 12:01:57 +00:00
Jermolene
689e172e79 Move some utility functions into boot.js
So that they are available to code running earlier in the boot process
2019-02-03 12:01:38 +00:00
Jermolene
7bc1458749 Boot: Enhance domMaker to support namespaces and styles 2019-02-01 10:43:14 +00:00
jed
baddd89abb Added flag to $tw.utils.parseStringArray to allow non-unique entries (#2027)
* Added flag to $tw.utils.parseStringArray to allow non-unique entries

With this change if you use $tw.utils.parseStringArray(list) you get identical behavior to before and enforces uniqueness in lists, but if you use $tw.utils.parseStringArray(list,true) it allows duplicate values in the list.

Because of how JavaScript handles overloaded functions this shouldn't have any affect on existing code that just passes one argument to the function.

* Update to hopefully remove merge conflicts
2018-10-21 16:58:41 +01:00
Jermolene
09112ed455 Add support for webp, heic, and heif image formats
https://en.wikipedia.org/wiki/WebP
https://en.wikipedia.org/wiki/High_Efficiency_Image_File_Format
2018-08-21 11:46:46 +01:00
Jermolene
6b14969cf6 Display a warning for binary tiddlers in view mode
The base64 data is currently parsed as wikitext, which is slow and unhelpful

We already display the same warning for binary tiddlers in edit mode.
2018-05-18 17:53:07 +01:00
Mario Pietsch
760c80c655 BibTex plugin: Fix a problem with MIME types under Ubuntu 18.04
Ubuntu 18.04 returns text/x-bibtex for .bib files instead of application/x-bibtex.
2018-05-16 14:20:51 +01:00
Jermolene
78e734797b Remove extraneous test error
Left over from testing RSOE
2018-05-10 15:30:32 +01:00
Jermolene
98bafd0b69 Tweaks for RSOD adjustments 7468ad7
Better to centre the button
2018-05-10 15:29:31 +01:00
Mario Pietsch
7468ad7acf Make rsod less annoying (#2799)
* give js-error form its own CSS rules. error form should not exceed screen size

* fix whitespace
2018-05-10 14:45:50 +01:00
Jermolene
c64fc164fc Fix mime type for 2c7f467 2018-05-04 17:49:21 +01:00
Jermolene
2c7f467514 Add support for /*\ style metadata comments at the top of CSS files
Just as we already support for JS files
2018-05-04 17:38:30 +01:00
Arlen22
f4496d8fd3 Allow specifying a custom boot path (#2990) 2018-04-08 09:38:28 +01:00
Jermolene
57e1fc6cd8 Add file type for true type fonts 2017-12-21 22:02:04 +00:00
Jermolene
358d416526 Further optimisations to wiki store
These changes give us a minor performance improvement for adding and deleting tiddlers
2017-12-21 22:01:52 +00:00
Jermolene
254e1ca7f7 Optimise some tiddler store operations
I noticed that the rendering of a TOC with around 200 entries seemed frustratingly slow.

First, I analysed the execution of the code using the Chrome developer tools "timeline" tab: prepare by switching to the "Tools" tab, then start profiling, switch to the "Contents" tab, and then stop profiling once it has displayed. I then used the "bottom-up" view to dectermine that the various Object.keys() calls in the main wiki store were taking around 500ms of the overall time.

Before making any code changes, I also used TW's built in instrumentation to get some baseline timings: I found that the main refresh cycle was taking around 3.0s when rendering the Contents tab.

I then performed the attached simple optimisations of caching the list of tiddler titles and the list of shadow tiddler titles.

The results bring the overall main refresh time down to about 1.9s, a nearly 50% improvement.

The moral of the story is that the first rule of optimisation is measurement...
2017-12-21 15:46:01 +00:00
Tobias Beer
a2c764d407 enable doc contributions for dev (#3047)
* enable doc contributions for dev

fixes #2921

* involves changes to boot.js to properly build OriginalTiddlerPaths on
Windows
* added ContributionBanner
* added Sources tab to info panel
* updated tiddlywiki.info for dev

* normalize path separator to posix for windows

* more generically transform to posix
2017-12-12 13:50:33 +00:00
Jermolene
29364cbd08 Change http://*.tiddlywiki.com/* to https:// 2017-11-11 11:56:20 +00:00
Jermolene
95b84dd0ca Use filename as default title when loading tiddlers under Node
Fixing this regression gets the `classictools` plugin working again
2017-11-05 14:14:00 +00:00
Jermolene
378e00aee8 Give a warning message for missing plugin.info files 2017-09-12 15:53:52 +01:00
Jermolene
e471bd54d4 Update Stanford JavaScript Library to 1.0.7 2017-07-18 15:42:35 +01:00
Jermolene
596dfa1d50 Allow manual selection of deserializer for dropping or importing files 2017-07-12 16:42:16 +01:00
Jermolene
a4035d3424 Coding style tweaks for #2885 2017-06-09 16:21:39 +01:00
Arlen22
0bc325025a Add a callback to $tw.boot.boot() (#2885)
* Add a callback to $tw.boot.boot()

* Move callback into the options object

* Update boot.js
2017-06-09 16:20:12 +01:00
Jermolene
4b780899a5 Move SJCL license file into core plugin
It was added as a separate system tiddler, but that means updating a
lot of filters to add and exclude it as appropriate (as we do with
$:/library/sjcl.js itself)
2017-04-23 09:53:18 +01:00
Jermolene
8804278e6e Add OpenOffice docx and pptx file types 2017-03-17 14:20:17 +00:00
Jermolene
779e62a30f Add support for JSON files containing a single tiddler
At the moment, we support JSON files containing an array of tiddlers.
With this change the core will import files containing a single
tiddler. Also adding templates for saving individual tiddlers in JSON
format
2017-03-17 14:19:43 +00:00
Jermolene
9fc2086b71 Optimise sameday filter
I used this test:

console.time();for(var t=0; t<200; t++)
{$tw.wiki.filterTiddlers("[all[tiddlers+shadows]sameday[20170210]]");};c
onsole.timeEnd()

Before this patch, I got speeds of approx 190ms, versus 140ms
afterwards.

Note that the ability to add a cache property like this is only
possible because tiddler objects are immutable.
2017-02-21 08:31:05 +00:00
Jermolene
75b501f681 Optimise $tw.utils.parseStringArray()
On my machine, the following test performed on the prerelease improves
from 40ms to 8ms with this patch:

```
var a =
$tw.utils.stringifyList($tw.wiki.allTitles());console.time();$tw.utils.p
arseStringArray(a);console.timeEnd()
```
2017-02-19 18:08:15 +00:00
Jermolene
d5b04c2688 Fix problem with loading metafiles
This issue was introduced in 1b41b44684.

Fixes problem raised by @pmario in
https://github.com/Jermolene/TiddlyWiki5/commit/3708f6c8e4f4bf2ea1cb10b0
fa685888485f788a#commitcomment-20848240
2017-02-12 12:14:04 +00:00
Jermolene
1961db6732 Register alternate mime type for Markdown files
macOS considers them to be `text/markdown`, which meant that dragging
an .md file ended up with the wrong content type
2017-02-11 12:48:41 +00:00
Jermolene
6b2ab90721 Update hook mechanism so that multiple parameters can be passed 2017-02-09 15:42:21 +00:00
Jermolene
ad9769451d Add filename-uri-decoded support for tiddlywiki.files 2016-12-15 17:13:32 +00:00
Jermolene
25b2e846ce Update to Stanford JavaScript Library v1.0.6
And add their license file
2016-12-15 17:13:32 +00:00
Jermolene
3c715c5e0d Extend require() to try appending index.js as well as .js
Better Common/JS compatibility
2016-11-23 18:13:26 +00:00
Jermolene
632e062749 Add epub file type 2016-11-14 15:14:33 +00:00
Jermolene
b8cbc07c54 Add support for uri decoded components in tiddlywiki.files files 2016-11-14 15:14:25 +00:00
Jermolene
7f11c151f0 First pass at bibtex importer 2016-10-18 18:00:01 +01:00
Jermolene
52cef1394c Fix typo in 1b41b44684 2016-10-18 13:33:54 +01:00
Jermolene
537cfcbf79 Addendum to #2610
* Ensure we don’t try to read tiddlers from `.meta` files
* Improve docs
2016-10-15 18:06:17 +01:00
Jermolene
1b41b44684 Improve support for bulk loading tiddlers under Node.js
Fixes #2610
2016-10-15 16:23:17 +01:00
Jermolene
e4f3d56bdc Correct reference to missing variable 2016-10-06 14:50:54 +01:00
Jermolene
20daaae7e8 Make $tw.utils.stringifyList() resilient to null values in the array 2016-09-30 18:28:12 +01:00
Jermolene
06b7de415c Ensure cancel button in login prompt doesn't also submit form
Fixes #2561
2016-08-29 19:13:25 +01:00
Jermolene
3a2ea9b98b Register .xlsx filetype 2016-08-20 17:08:44 +01:00
Jermolene
da1905b789 Revise default for Buffer in the browser
Back in 7d12d89a0a we added support for
Node.js global `Buffer` object, explicitly exposing it to the module
loader sandbox. The value `{}` was used in the browser, but is now
causing problems with libraries that perform feature detection.
2016-08-20 17:08:24 +01:00
Jermolene
ba2f831d8c Fix parsing of multids files
The old code required a space after the colon separating the title
fragment from the text, and didn’t trim the strings. The new code is
more tolerant, by not requiring the space, and trimming the strings.
2016-08-18 08:58:54 +01:00
Jermolene
e282ff1d92 Fix problem with tiddler titled "undefined"
Fixes #2507

The problem stems from a JavaScript quirk: the fact that
`({“undefined":"Me"})[undefined]` returns “Me”. The quirk is that the
value `undefined` is coerced into the string “undefined” when used as
an index.

In this particular case, the code for `wiki.getTiddler()` was returning
the tiddler with the title `”undefined”` when called with the title set
to the value `undefined`. It happens that the pluginswitcher called
`wiki.getTiddler(undefined)`.
2016-07-22 11:31:02 +01:00
Myeongjin
e6e346ea29 change string 'Close' to lowercase for dialog (#2366) 2016-04-14 23:03:14 +01:00
nome
811aa23010 Include tiddler line number in SyntaxError output
While JavaScript runtime errors include the line number within the

module tiddler where the error occured, syntax errors do not, leaving

the user guessing where the error is hiding. Attempt to remedy this, as

well as the various platforms permit.
2016-04-04 12:46:48 +01:00
Myeongjin
c9b0e15201 add localisable strings for dialog 2016-03-28 16:24:55 +09:00
Jermolene
b47f505588 Freeze the entire tiddler object
As seen in the first pass of #2247, it was previously inadvertently
possible for callers to modify the tiddler object itself by adding and
replacing properties.
2016-02-05 17:39:02 +00:00
Jermolene
8904a6dba6 First commit of Evernote migration plugin
Starts to address #2268
2016-02-04 10:13:08 +00:00
Jermolene
ad1793c8f5 Minor tweaks to boot kernel for AWS
Part of the upcoming AWS integration work is a custom build of
TiddlyWiki that can run as an Amazon Lambda function. These tweaks
enable the new build to control the loading of SJCL, the package info,
and any preloaded tiddlers.
2015-12-19 18:52:25 +00:00
Myeongjin
2fee131aa4 add localisable strings for Internal JavaScript Error 2015-10-18 17:26:42 +09:00
Jermolene
99df9f46f7 Add support for tiddlers containing mp4 videos 2015-10-01 12:13:38 +01:00
Jermolene
803d70225a Allow tiddlywiki.files to load directories recursively 2015-09-15 13:35:54 +01:00
Jermolene
ae80f9176d Typo from last commit 2015-08-31 16:25:03 +01:00
Jermolene
709126dd64 Don't queue change events for deleting non-existent tiddlers
Fixes #1919
2015-08-31 15:48:32 +01:00
Jermolene
9168480d18 Clear caches when changing plugins 2015-08-02 22:22:33 +01:00
Jermolene
73210a7b8c Refine the way that we support serialised external tiddler files
The old way was sufficiently backwards compatible that it was
impossible to use TiddlyWiki 5.1.9 to build the tw5.com edition.
2015-07-28 19:56:56 +01:00
Jermolene
ecbd97b4b4 Revise support for external tiddler files
Fixes #1884
2015-07-18 11:45:30 +01:00
Jermolene
8f63e2a959 Optimise iterating through tiddlers
Astonishingly, it’s much quicker to use `Object.keys()` to get an array
of key names, and then iterate through that. I’m seeing 25% speed
improvements for an empty tiddler iterator.
2015-07-08 08:27:28 +01:00
Jermolene
c6e48ebc2d Performance optimisations
In some situations, I’m seeing x2.5 speedups with these optimisations

Starts fixing #1864
2015-07-05 19:47:44 +01:00
Jermolene
53072dd7aa Extended tiddlywiki.files to support tiddler files
Previously, we just read the target file as a block of UTF-8. With this
update, we deserialise the file, allowing us to use file formats like
.tid within the tiddlywiki.files file.
2015-06-23 10:49:59 +01:00
Jermolene
81e4d43a25 Debug hooks for tracing tiddler deletions 2015-05-13 23:55:00 +01:00
Jermolene
e9a1a53922 Better error checking for reading field lists
This change ensures that lines starting with a colon are ignored,
allowing them to be used as comments.
2015-05-07 19:24:58 +01:00
Jermolene
48dcf959ff Refactor browser unload task handling
Make it possible to register multiple task functions that will be
called when the window is unloaded
2015-05-03 16:23:35 +01:00
Andreas Abeck
2c367c5476 added localisation for encryption dialog & de-DE translation 2015-03-18 18:52:33 +01:00
Felix Küppers
f99a4e7664 Bugfix: Object.freeze() called on null
For five minutes I stared at the following code...

    if(value != null && typeof value === "object") {
      Object.freeze(value);
    }

... and at the error message that led me to this code: `Object.freeze called on non-object`

And then I remembered that js treads null as object (http://www.ecma-international.org/ecma-262/5.1/#sec-11.4.3). This means the `typeof === "object"` will not discover null and freeze will throw an error...

So `value != null` will also work when value is undefined.

A hard to find bug ;)
2015-03-07 20:47:43 +01:00
Jermolene
a2493f80a9 Add support for zip files 2015-02-23 11:57:16 +01:00
Jeremy Ruston
6c62954116 Merge pull request #1505 from pmario/fix-search-path-runtime-error
Fix trailing semicolon in TIDDLYWIKI_EDITION_PATH
2015-02-17 20:56:14 +00:00
Mario Pietsch
e1b57bf9e5 remove temporary variable 2015-02-17 01:29:42 +01:00
Jermolene
e386e26b2d Fix problems with $tw.utils.checkVersions()
Previous changes since 5.1.7 broke the documented semantics by no
longer returning true when the versions match. It affected the upgrade
process, making it impossible to upgrade to a later pre-release (ie
where the version numbers in the upgrade.html match those in the file
being upgraded).

Also reviewed and updated the calls to checkVersions.

@felixhayashi I think that this effectively reverts the change you
original submitted. Are you OK with it?
2015-02-12 23:04:20 +00:00
Mario Pietsch
95d7a826f0 space added 2015-02-12 20:03:20 +01:00
Mario Pietsch
17c38b1ec5 fix problem if edition search path is TIDDLYWIKI_EDITION_PATH=c:\test; because the trailing semicolon creates an empty directory name. 2015-02-12 14:44:10 +01:00
Jermolene
4b61cae262 Add debugging hook for wiki.addTiddler() 2015-02-10 11:30:39 +00:00
Jermolene
b1bb52b67a Fix typo from 8cd0c2afcd 2015-02-07 10:23:16 +00:00
Jim Lehmer
8cd0c2afcd Make sure all "get" access to $tw.config.fileExtensionInfo goes through a $tw.utils.getFileExtensionInfo helper function that ensures the parameter is cast to lowercase. Fixes #1418. 2015-02-01 12:33:40 -06:00
Jermolene
3bbbda0819 Allow callers of the bootprefix to determine browser status
This gives us finer control under node-webkit of whether the core
thinks we’re running under the browser or node.
2015-01-11 14:21:31 +00:00
Felix Küppers
70cbb5efc5 Update boot.js
if major, minor and patch are equal, the incoming wins.
2014-12-23 19:21:54 +01:00
Felix Küppers
d33b525067 Update boot.js 2014-12-23 18:13:59 +01:00
Felix Küppers
1d344dba69 prerelease matters
incoming 3.7.2 loses against existing 3.7.2
incoming 3.7.2-prerelease loses against existing 3.7.2
incoming 3.7.2-prerelease wins against existing 3.7.2-prerelease
2014-12-23 13:53:58 +01:00
Felix Küppers
9fad60beb3 another suggestion
in case of equal versions, use the incoming and replace the existing.
2014-12-21 20:55:44 +01:00
Felix Küppers
e00534635e Update boot.js 2014-12-19 19:24:13 +01:00
Jermolene
1e3a41311d Use OS-independent path delimiter
Fixes #1187
2014-12-03 17:24:59 +00:00
Jermolene
e11c9e83b9 Coding style cleanup 2014-12-02 15:32:52 +00:00
Tobias Beer
4d68111c49 added object as third parameter to callback 2014-12-02 12:47:19 +01:00
Tobias Beer
0f157cff90 code style revision
thanks, Jeremy... will watch out for that
2014-11-26 18:50:12 +01:00
Tobias Beer
1e47a62c2a allows to break out of $tw.utils.each
Will improve performance with `$tw.utils.each` callbacks breaking out of
the iteration via `return false;`.
2014-11-26 17:51:27 +01:00
Jeremy Ruston
92b957f6f8 Merge pull request #1118 from welford/hook
Add hooks mechanism and th-opening-default-tiddlers-list hook
2014-11-25 19:25:00 +00:00
Jermolene
62ad533aa6 Clarify tiddlerExists docs 2014-11-24 09:22:43 +00:00
Jermolene
a614c0d543 Improve compatibility with JS modules
If a module ended with a single line comment `\\` then the appended
`;})();` was being ignored and eaten up as part of the comment.
2014-11-23 15:24:01 +00:00
James Welford Anderson
804a579d17 Remove alert from addHook.
Thanks to @tobibeer
2014-11-23 14:34:04 +09:00
James Welford Anderson
90caf5bf42 Add hooks mechanism and th-opening-default-tiddlers-list hook
see: https://github.com/Jermolene/TiddlyWiki5/issues/1064
2014-11-23 01:11:56 +09:00