1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-01-22 10:54:46 +00:00

Compare commits

...

385 Commits

Author SHA1 Message Date
jeremy@jermolene.com
b4dcf9a338 Allow matchSelector to be used even if selector attribute isn't used 2022-03-14 09:30:35 +00:00
jeremy@jermolene.com
a893791f97 Initial Commit 2022-03-11 16:40:11 +00:00
Saq Imtiaz
aaf1aa3821 Improve affordances for new browser windows (#6498)
* feat: extend tm-open-window to allow opening the same tiddler in multiple templates, and introduce tm-close-window to close browser windows

* fix: use a windowID parameter to uniquely identify a window and introduce tm-close-all-tiddlers

* fix: whitespace

* fix: update variable
2022-03-02 17:34:02 +00:00
jeremy@jermolene.com
8114d5475b Update release note 2022-03-01 16:56:52 +00:00
jeremy@jermolene.com
29599baa3b Merge branch 'tiddlywiki-com' 2022-03-01 16:49:36 +00:00
Saq Imtiaz
b196cf77e8 Sort sidebar language, plugin and theme list by name rather than description (#6501) 2022-03-01 09:23:19 +00:00
jeremy@jermolene.com
4d3ebf4bf0 Revert "fr-FR next batch of translation updates (#6489)"
This reverts commit b3268546ef.
2022-02-27 17:23:36 +00:00
tw-FRed
b3268546ef fr-FR next batch of translation updates (#6489)
* Move GettingStarted to the right place

Previous batch of translations changed the wrong file

* Revert #6467 for GettingStarted

* Delete $ _editions_tw5.com_doc-macros.tid

Wrong name for the updated tiddler

* Update $__editions_tw5.com_doc-macros.tid

* Translation updates

* Update of 2 tiddlers referenced on HelloThere

* 5 more tiddlers, referenced in WikiText.tid
2022-02-27 17:21:55 +00:00
Saq Imtiaz
615d8da64f Docs: mention MessageCatcher widget in LinkCatcher tiddler (#6485) 2022-02-26 18:59:45 +00:00
TW Videos
45a1478bc9 Allow TiddlyVee to submitt PRs (#6487)
This is pmario and TiddlyVee will be used to create real PRs shown in videos
2022-02-26 18:48:49 +00:00
TW Videos
a071881562 Links to CLA: change branch from master to tiddlywiki-com (#6488) 2022-02-26 18:45:58 +00:00
Ben Webber
2c38c8351b Make butlast[0] consistent with rest (#6483)
butlast[0] now returns the input list unchanged.

Fixes: #5833
2022-02-26 09:42:24 +00:00
Ben Webber
a51191d334 Support specifying insertbefore position title as parameter (#6477)
* Support specifying insertbefore position title as parameter

Closes: #6133

* Update insertbefore calls with new variable parameter syntax

See-also: 96b52606a (Support specifying insertbefore position title as parameter, 2022-02-21)
2022-02-24 11:08:06 +00:00
Saq Imtiaz
4054566493 Extend $draggable to support an optional drag handle (#6480)
* feat: extend  to support a selector attribute identifying the DOM element to be used as the drag handle

* fix: remove redundant variable declaration

* fix: remove extranneous variable declaration
2022-02-24 11:06:18 +00:00
Marxsal
5f994f7d46 Savers: Polly (#6481)
* Savers: Polly

* Polly, with url
2022-02-23 21:47:21 +00:00
Ben Webber
7a7472833f Consider non-existent tiddlers untagged (#6478)
Fixes regression introduced in 575c23359.

Fixes: #6119
See-also: 575c23359 (Update untagged filter to avoid $tw.utils.pushTop (#6034), 2021-09-18)
2022-02-23 12:46:34 +00:00
Marxsal
9777aa9d13 Webdav - category "paid" hosting (#6476) 2022-02-22 19:56:07 +00:00
Cameron Fischer
d0b5b2124a Is draft (#6442)
* corrected [!is[draft]] to be a proper complement

* Ensuring [is[draft]] and [!is[draft]] are complements

* Made [is[draft]] more analogous to .isDraft()
2022-02-22 16:41:29 +00:00
Ben Webber
95bd694a65 Support case insensitive matching in prefix/suffix operators (#6468)
* Support case insensitive matching in prefix/suffix operators

Support `caseinsensitive`/`caseinsensitive` suffixes in the following
filter operators:

  * prefix
  * suffix
  * removeprefix
  * removesuffix

The suffixes have the same behaviour as in the match operator.

Closes: #6407

* Do not filter titles if suffix/removesuffix operand is empty

Issue: #6407
2022-02-22 16:38:40 +00:00
jeremy@jermolene.com
49de500b5e Add contributors to release note 2022-02-22 09:54:46 +00:00
jeremy@jermolene.com
4cf3df0f86 Merge branch 'tiddlywiki-com' 2022-02-22 09:25:15 +00:00
jeremy@jermolene.com
1ae1ff3da2 Update release note 2022-02-21 17:38:11 +00:00
cdruan
4f42df8bef Update highlight.js to v11.4.0 (#6427)
* Rename v9 highlight.js plugin to highlight-legacy

* Add ES6 version of highlight.js plugin

* highlightblock.js

	- ensure this ES6 plugin will not cause error on legacy browsers
	- update the code to use new highlight.js APIs
	- change class tagging to match more closely with highlight.js
	- allow users to add language definitions as JS "highlight" modules

* styles.tid

	- update to match v11

* howto.tid

	- add instructions on how to add language definitions as JS modules

* highlight.min.js, default.min.css

	- version 11.4.0 common languages only

* Remove extraneous whitespaces

* Update readme.tid

* Update bundled languages

bundled: common + apache + nginx + latex + dockerfile + fortran

* Update highlight-legacy subtiddlers' titles

* Touch up highlight-legacy docs

* Touch up highlight plugin docs

* Fix pre block styling

- add "hljs" class to <pre> so the element can be styled
2022-02-21 15:35:13 +00:00
Jeremy Ruston
36b162a377 Fix for tag ordering issue #6382 (#6383)
* Failing test

* Fix underlying problem

* Less naive fix

Now we make sure we maintain the sort order of the titles array when adding a new tiddler

* Fix failing tests

* Refactor filter tests to repeat them with different store orderings

* Revert "Fix failing tests"

This reverts commit ee03ee57f5.

* Refine fix to retain stylesheet ordering

The order of tiddlers in the HTML file uses localeCompare(), and that determines the insertion order. So if we want to be compatible with older versions we have to use localeCompare() to order tiddlers, not a plain sort()

* Don't sort shadow tiddlers

Instead rely on the existing ordering

* Fix failing tests, take 2

I think that all of these changes are explained by the store no longer retaining insertion order, but now using localecompare ordering

* Fix tests from #6327
2022-02-21 15:34:05 +00:00
Jeremy Ruston
82c8fe7fa8 Introduce JSON parse utility function with error handling (#6401)
* Introduce JSON parse utility function with error handling

Fixes #6400

* Fix typo
2022-02-21 15:29:25 +00:00
Jeremy Ruston
5378b45c40 Allow newlines within filtered transclusions (#6421)
* Allow newlines within filtered transclusions

* Docs
2022-02-21 15:28:21 +00:00
Jeremy Ruston
ab3109d84b Add support for directly setting style.* attributes on HTML elements (#6388)
* Support direct style attributes on the element widget

* Fix tests

Not all parse tree nodes have an "orderedAttributes" member (eg. the error message generated at 5613bcc884/core/modules/widgets/transclude.js (L73-L75))

* Ensure ordering isn't insertion dependent if orderedAttributes is missing

* Add docs
2022-02-21 15:24:06 +00:00
Cameron Fischer
a4ab42da8a findListingsOfTiddler should cache results (#6327)
* findListingsOfTiddler uses FieldIndexer now

* Turns out FieldIndexer can't help listed[]
2022-02-21 15:07:30 +00:00
jeremy@jermolene.com
af87727ffc Adjust version tag for #6293 2022-02-21 15:06:39 +00:00
Mario Pietsch
6b4e5c74ad Add "some" flag to search operator (#6293) 2022-02-21 15:05:34 +00:00
lin onetwo
94ab1e998d Create Saving on TidGi.tid (#6473) 2022-02-21 12:23:50 +00:00
jeremy@jermolene.com
8af99878cc Add version tags for #5899 2022-02-21 09:56:05 +00:00
Joshua Fontany
d6d2bc455c Fix server options (#5899)
* removed illegal cahracter in filename

* fixes required plugin options & updates docs

* Update dev docs

* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* adds path based auth (backwards compatible)

* refactor per-route auth

* get status bug

* server options

* server options

* server options, new 'server-settings' param

* reflow

* fix boot.origin

* refactor new parameters

* restore sitetitle as servername option

* Soft reset to master

* docs update

* tweak wording

* docs

* cleanup

* remove literal string

* cleanup docs

* formatting

* Remove per-path auth

* revert get-status

* fold in PR 5538

* remove server-options

* remove doc

* required-plugins a server-parameter, not option
2022-02-21 09:53:06 +00:00
jeremy@jermolene.com
d5ff723d4c Update version tag for #5742 2022-02-21 09:49:55 +00:00
Joshua Fontany
1d0af90ba2 Extend lookup operator to work with fields and indexes (#5742)
* extend lookup op flexibility with 2 parameters

* bumped .from macro to .24

* aligned syntax

* lookup fixes

* bugfix

* docs

* messed up the tests somehow

* docs fix

* lookup bugfix

* docs

* docs

* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* storylist

* tests

* tests pass
2022-02-21 09:48:29 +00:00
tw-FRed
b12d6c0758 Use cascade for FR ViewTemplate title instead of shadow tiddler (#6471)
* Delete $__core_ui_ViewTemplate_title.tid

fr-FR modifications to ViewTemplate/title can now be done through cascades mechanism.

* fr-FR New ViewTemplate title cascade

Replacement for old fr-FR ViewTemplate/title shadow tiddler

* fr-FR Better ViewTemplate title cascade

Updated according to @Jermolene review.
2022-02-20 19:38:13 +00:00
tw-FRed
a89677ea40 [fr_FR] French translation update (#6467)
* [fr_FR] Add utility macro for translated links

* Update Saving.tid

* Add TiddlyFox Apocalypse translation

* Update TiddlyFox.tid

* Translate Community Links Aggregator.tid

* Update Forums.tid

* Update Developers.tid

* Update HelloThere.tid

* Update GettingStarted.tid

* Update Community.tid

* Update tw5.com edition macros from uplink

Some text in these macros must be translated.

* Various translation updates

* Clean utility fields I had left over

* Clean older files too
2022-02-20 17:25:25 +00:00
Saq Imtiaz
59572cd75d Extend tm-open-window to support optional top and left position for new browser window (#6470)
* feat: extend tm-open-window to support optional top and left position for new browser window

* fix: whitespace correction

* Update WidgetMessage_ tm-open-window.tid
2022-02-20 11:23:27 +00:00
jeremy@jermolene.com
1d16206188 Add support for tm-relink-tiddler message 2022-02-19 09:38:48 +00:00
jeremy@jermolene.com
37a6ff8521 Move tm-rename-tiddler handling from navigator widget into startup module
This reverses an August 2015 change in 68e15c10641e2eda1e64cf29954786a07326a920; the original rationale was wrong: there is nothing related to the navigator widget in the implementation of the tm-rename-tiddler message
2022-02-19 09:20:32 +00:00
jeremy@jermolene.com
d3ea98fcef Menubar plugin: fix class handling for dropdowns
Fixes  #6457
2022-02-14 10:44:42 +00:00
Bram Chen
5022516c61 Update chinese language files (#6449)
* Update chinese field descriptions

* Revised chinese translations for `DropMessage`
2022-02-08 16:01:30 +00:00
jeremy@jermolene.com
965d8ee014 Update release note 2022-02-08 15:40:15 +00:00
Marxsal
8e50ad1243 Change 'Drop here' to 'Drop now' in import msg (#6435) 2022-02-07 17:32:06 +00:00
jeremy@jermolene.com
33f40c47c6 Use code-body: yes for more templates
Fixes #6444
2022-02-07 16:53:36 +00:00
Cameron Fischer
1b3c2557b8 Fixed issue: deprecated regexp could cause crash (#6438)
* Fixed issue: deprecated regexp could cause crash

* Different fix which will bother plugins less
2022-02-07 16:39:29 +00:00
Dyllon Gagnier
6b31d7cae3 Add TW5-browser-nativesaver to tw5.com docs (#6447)
* Signing the CLA

* Add TW5-browser-nativesaver to tw5.com docs

Co-authored-by: Jeremy Ruston <jeremy@jermolene.com>
2022-02-06 10:49:48 +00:00
jeremy@jermolene.com
1a4766c5a1 Merge branch 'tiddlywiki-com' 2022-02-05 16:39:35 +00:00
btheado
3e62e8406b Docs: Compare the wikitext concept of inline vs. block to the corresponding HTML concept (#6443) 2022-02-03 19:22:24 +00:00
jeremy@jermolene.com
e49dda3b48 Fix search results cutoff on narrow screens
Fixes #6440
2022-02-01 09:36:30 +00:00
jeremy@jermolene.com
bd447f0716 Add talk.tiddlywiki.org as the official forum for the community 2022-01-31 17:05:55 +00:00
RJ Skerry-Ryan
13faeaa0bd Markdown: Let WikiText parsing handle the creation of LaTeX widgets. (#6428)
* Markdown: Let WikiText parsing handle the creation of LaTeX widgets.

When embedding LaTeX snippets in inline HTML nodes, such as TiddlyRemember
macros or HTML tables, the parsing of latex nodes breaks the WikiText by
splitting it into pieces around the latex node.

This commit fixes the issue by converting the Remarkable katex nodes back to
text, using a newline to indicate a block katex snippet. This is then re-parsed
by the WikiText KaTeX plugin.

TESTED:

Created a test wiki with:
```
$ node tiddlywiki.js test --init markdowndemo
$ node tiddlywiki.js test --listen
```

* Verified markdown + KaTeX support still works as expected.
* Verified that embedding LaTeX snippets in inline HTML works (e.g. `<a
href="https://example.com/">$x^2$</a>`).
* Verified the markdown + KaTeX support works as expected with renderWikiText
set to `false`.

* Style: Remove spaces between if and opening parentheses.
2022-01-30 11:23:00 +00:00
twMat
7f0fb2b610 [doc] Update Importing Tiddlers.tid - attempt 2 (#6432) 2022-01-30 11:17:39 +00:00
Rizwan
7d2994388b Remove 2 whitespaces (#6434)
These whitespaces were messing the list rendering
2022-01-30 11:07:32 +00:00
RJ Skerry-Ryan
edb5dc3fdc Add keyword-spacing rule to .eslintrc.yml to reflect the project code style. (#6431)
- Update .eslintignore to ignore "third party" code.
- Add a "lint" script to package.json so `npm run lint` runs eslint on the repo.
2022-01-29 17:41:09 +00:00
Marxsal
df1b1316c8 One word change to 'Images in WikiText' (#6430) 2022-01-29 15:39:29 +00:00
jeremy@jermolene.com
1a0c831216 Add sha256 operator 2022-01-29 11:02:47 +00:00
jeremy@jermolene.com
f4365e4bb4 Macro: remove confusing advice
See https://talk.tiddlywiki.org/t/wikitext-parsing-and-rendering-in-macros/2218
2022-01-28 11:24:06 +00:00
Saq Imtiaz
75d10a2dc3 Fix: bug with importvariables widget when importing block mode widgets. fixes #6424 (#6426) 2022-01-27 17:35:18 +00:00
Marxsal
da7cf7a4f3 QualifyWidget documentation (#6422) 2022-01-25 17:59:59 +00:00
Saq Imtiaz
6452eb56a9 fix: bug introduced with 88812092fd fixes #6419 (#6420) 2022-01-24 19:17:09 +00:00
Saq Imtiaz
9fce8153df Add support to tm-scroll message for scrolling without animating (#6410)
* feat: add support for animationDuration attribute of paramObject for tm-scroll message

* docs: added docs for animationDuration attribute of tm-scroll message

* fix: use .utils.hop instead of Object.hasOwnProperty()

* fix: do not check if object before calling utils.hop()

* fix: syntax
2022-01-24 09:44:04 +00:00
jeremy@jermolene.com
4cdfa4e3f9 Update tm-download-file docs to mention the filename parameter 2022-01-23 18:35:38 +00:00
btheado
d6384df6fc Add warnings about non-recursive nature of dynamic attribute values (#6417) 2022-01-23 18:24:25 +00:00
btheado
f0bd06b38d Add doc related to WikiText parser modes (#6415)
* Added macros for displaying wikitext examples in a table

* Added documentation for WikiText parsing

* Changed recognize to British spelling

* Add links to the new wikitext parser tiddlers
2022-01-23 09:44:01 +00:00
Saq Imtiaz
d823856082 feat: add support for renderEnd method for storyviews in widget's render() method (#6409) 2022-01-19 19:48:02 +00:00
twMat
b02a82ba0f Update list-links-draggabe Macro.tid (#6405)
The commented problem is, I presume, resolved now that we can directly edit fields in the current tiddler.
2022-01-19 11:13:08 +00:00
twMat
c43b013539 Paragraph on "anchor links" for Linking in WikiText.tid (#6404) 2022-01-18 19:27:54 +00:00
twMat
5548186c93 Update size attribute in EditTextWidget.tid (#6403)
ref: https://github.com/Jermolene/TiddlyWiki5/issues/6165
2022-01-17 10:11:20 +00:00
twMat
def9b553a8 typo in EventCatcherWidget.tid (#6399) 2022-01-15 12:57:51 +00:00
jeremy@jermolene.com
35f7a8ea06 Fix renaming a tiddler can result in duplicate tags
Fixes #6398
2022-01-14 16:57:30 +00:00
jeremy@jermolene.com
54bfb28063 Merge branch 'tiddlywiki-com' 2022-01-11 17:51:32 +00:00
jeremy@jermolene.com
80c63b96cf Fix processing of $:/tags/RawMarkupWikified/TopHead tiddlers
Fixes #6395
2022-01-11 17:16:50 +00:00
Nils Lindemann
2ef9ecbc44 Signing the CLA (#6394)
* Using a different account now (Second try)

* Typo
2022-01-10 09:34:02 +00:00
jeremy@jermolene.com
88812092fd Fix crash with "wrap-lines" text editor operation if prefix or suffix is missing
Fixes #6376
2022-01-09 17:43:34 +00:00
jeremy@jermolene.com
4e01fc1838 Radio widget should use default if field/index is missing
Fixes #6389
2022-01-09 17:17:12 +00:00
Louis Davout
5cab75f4a7 In 'Filter Operators' add column to indicate those operators that construct an entirely new selection. (#6351) 2022-01-09 14:44:19 +00:00
btheado
1345384d39 Add section about dynamic links to 'Linking in WikiText' (#6361)
* Add discussion of dynamic links to 'Linking in WikiText'

* Added macro and styles for displaying a 'bad' example

* Use .bad-example macro in 'Linking in WikiText'

* Convert existing warnings to use .bad-example macro
2022-01-09 14:30:22 +00:00
Bram Chen
927013a57a Update chinese field descriptions (#6393) 2022-01-09 14:26:14 +00:00
jeremy@jermolene.com
0d11fccba2 Update release note 2022-01-09 10:18:19 +00:00
jeremy@jermolene.com
d78ad756db Docs missed off 54cfda76ee 2022-01-09 10:18:11 +00:00
jeremy@jermolene.com
5613bcc884 It's 2022 2022-01-03 20:22:52 +00:00
jeremy@jermolene.com
0729d730f8 Merge branch 'tiddlywiki-com' 2022-01-03 20:22:05 +00:00
jeremy@jermolene.com
f2422efeb8 Fix issue with Alice in Wonderland demo
Thanks @pmario

See https://github.com/Jermolene/TiddlyWiki5/pull/6213#issuecomment-1003628637
2022-01-03 20:20:48 +00:00
Cameron Fischer
cbb002ec4b Added sourceURL tags to boot js (#6381) 2022-01-03 17:25:40 +00:00
jeremy@jermolene.com
c7e8c87f85 Refine criteria for displaying $:/core/ system tiddlers as code
Fixes #6369
2022-01-03 16:42:50 +00:00
jeremy@jermolene.com
66ae1d6930 Image widget: Add classes for loading/loaded/error 2022-01-02 17:28:54 +00:00
jeremy@jermolene.com
8e3885277f Update messagecatcher widget example to use newer syntax 2021-12-22 15:31:35 +00:00
jeremy@jermolene.com
9293dfa477 Add docs for "help" field of modals
Previously undocumented for no good reason
2021-12-21 10:26:58 +00:00
Louis Davout
8a80d89582 Signing the CLA (#6347) 2021-12-20 19:36:51 +00:00
btheado
10ebd93df3 Add ViewWidget cross references and examples (#6355)
* Link ViewWidget formats to similar filter operators

* Merge the ViewWidget columns and use the tip macro instead

* Reference the format filter operator in ViewWidget

* More accurate language in the ViewWidget docs
2021-12-20 10:07:34 +00:00
jc-ose
d414eef773 Clarify list location requirement (#6338) 2021-12-14 22:27:05 +00:00
jc-ose
7d1f0ea8f4 Signing the CLA (#6337) 2021-12-14 22:26:22 +00:00
twMat
f477e90192 Update Cascade Filter Run Prefix.tid (#6340) 2021-12-14 22:21:49 +00:00
Maurycy Zarzycki
b4dec78a72 add polish translations to cascades (#6335) 2021-12-13 17:28:35 +00:00
jeremy@jermolene.com
60187dc59e Fix importing/upgrading encrypted single file wikis
The problem was that v5.2.0 trimmed the whitespace from $:/core/templates/store.area.template.html which we'd previously been relying on during the import.

This change still allows v5.2.2 to import encrypted pre-v5.2.0 wikis

Fixes #6330
2021-12-11 19:46:20 +00:00
twMat
4453aefad8 Typo in Images in WikiText.tid (#6328)
Typo in link
2021-12-11 09:29:26 +00:00
jeremy@jermolene.com
54cfda76ee ViewTemplateBodyCascade: Add support for code-body field
Missed off #6168
2021-12-09 20:47:51 +00:00
Rizwan
1e8c2821d6 Acknowledgements for banner design 5.1.21-5.2.0 (#6326) 2021-12-09 17:40:12 +00:00
jeremy@jermolene.com
cbc030fbe2 Merge branch 'tiddlywiki-com' 2021-12-09 11:57:16 +00:00
jeremy@jermolene.com
b454116163 Add banner image credits for v5.2.1
See https://talk.tiddlywiki.org/t/the-banner-designer-should-be-acknowledged-in-the-whats-new-section/1787

cc @ibnishak
2021-12-09 11:56:31 +00:00
jeremy@jermolene.com
0186c6490f Edit type dropdown: Add whitespace between description and MIME type 2021-12-08 21:25:44 +00:00
jeremy@jermolene.com
853a899c77 Avoid wraping field names in field viewers
Also avoid wikifying field names
2021-12-08 19:29:02 +00:00
jeremy@jermolene.com
95a3d7fde2 Temporary new release banner for v5.2.2 2021-12-08 12:42:08 +00:00
jeremy@jermolene.com
d33e0a05e2 Preparing for v5.2.2-prerelease 2021-12-08 12:22:51 +00:00
jeremy@jermolene.com
cb833b3f65 build-site.sh: Update version number 2021-12-08 12:21:16 +00:00
jeremy@jermolene.com
b73c50adeb Version number update for 5.2.1 2021-12-08 12:17:32 +00:00
jeremy@jermolene.com
fdfa45329a Updating readme and contributing 2021-12-08 12:16:55 +00:00
jeremy@jermolene.com
7b1880404c Preparing for release of v5.2.1 2021-12-08 12:01:56 +00:00
jeremy@jermolene.com
2739b1bafe Merge branch 'tiddlywiki-com' 2021-12-08 11:56:50 +00:00
jeremy@jermolene.com
cc782ff518 Update release note 2021-12-08 11:55:40 +00:00
jeremy@jermolene.com
492bfbebe9 Sidebar plugin listing
Fix text colour in DarkPhotos and Muted palettes

Thanks @kookma

See https://github.com/Jermolene/TiddlyWiki5/discussions/6167#discussioncomment-1768298
2021-12-07 21:30:38 +00:00
jeremy@jermolene.com
c9fbff265a Update release note 2021-12-07 13:19:37 +00:00
jeremy@jermolene.com
b0f72d0690 Improve sidebar plugin listing
Fixes #6167
2021-12-07 13:17:15 +00:00
Marxsal
6070a2c921 Add two cloud services that support webdav (#6292) 2021-12-07 12:48:17 +00:00
jeremy@jermolene.com
cb43b91ab6 Add official v5.2.1 banner
See https://groups.google.com/g/tiddlywiki/c/GU0TPGNMPvw/m/y1SyQk_nAQAJ
2021-12-06 17:26:34 +00:00
jeremy@jermolene.com
804bc9e9c0 Merge branch 'tiddlywiki-com' 2021-12-06 17:05:43 +00:00
jeremy@jermolene.com
4514a67a1f Add user documentation for cascade mechanism 2021-12-06 16:59:13 +00:00
jeremy@jermolene.com
edcba4ee16 Docs Macros: Add new <<.tiddler-fields>> macro 2021-12-06 16:59:07 +00:00
jeremy@jermolene.com
9e28356047 Cascades: Ignore draft configuration tiddlers 2021-12-06 16:25:51 +00:00
btheado
44ad8c770f Added documentation tiddlers for intersection filter run prefix (#6307) 2021-12-05 17:27:35 +00:00
btheado
2dd4fa41a5 Add documentation tiddlers for filter filter run prefix (#6310)
* Added documentation tiddlers for filter filter run prefix

* Added examples to compare :filter filter run prefix to :and prefix
2021-12-04 20:44:04 +00:00
tw-FRed
f5389b3859 [FR_fr] Fix Latest Version image not displaying (#6308)
Image broken link on the welcome screen of French documentation edition.
See "Quoi de neuf dans la version 5.2.0" here: https://tiddlywiki.com/languages/fr-FR/index.html#HelloThere
2021-12-04 18:21:28 +00:00
tw-FRed
65c8d74218 Sign the CLA (#6306) 2021-12-04 17:34:57 +00:00
btheado
f88e3939e1 Add a cascade filter run example (#6302) 2021-12-04 10:25:43 +00:00
jeremy@jermolene.com
769778b05b Fix tag of control panel tab for edit template cascade
Missed off a350a76a00 (diff-902fbf6814c65f26a991299f17ef1698df82d1004af8d10d81a11a14660e805c)
2021-12-02 19:25:33 +00:00
jeremy@jermolene.com
f84ff0d778 Update release note 2021-12-02 19:21:07 +00:00
Boris Mann
ca1aabe21f Signing TW CLA (#6076)
Co-authored-by: Jeremy Ruston <jeremy@jermolene.com>
2021-12-01 14:57:46 +00:00
jeremy@jermolene.com
dd801d1571 Merge branch 'tiddlywiki-com' 2021-12-01 09:08:46 +00:00
Saq Imtiaz
485730483b Docs: reference documentation for :cascade filter run prefix (#6294)
* docs: formal documentation for :cascade filter run prefix

* fix: typos

* fix: typos
2021-11-30 15:07:10 +00:00
jeremy@jermolene.com
8b6733d792 Docs: Add a new overview of customisation techniques 2021-11-29 09:21:50 +00:00
Saq Imtiaz
75aabcce64 Fix for CodeMirror issues with drop events in Chrome 96 (#6278)
* fix: handle drag events ourselves in chrome when it adds pseudo file objects to the event

* fix: corrected typo in comment

* fix: coding style

* fix: formatting and remove comments
2021-11-28 14:46:27 +00:00
jeremy@jermolene.com
5dfa6b2bb4 Remove "Page and tiddler layout customisation" and most of the excised subtiddlers
These tiddlers are poor quality, and the titles are long and clumsy
2021-11-27 08:40:56 +00:00
btheado
3798a3c7d0 Add NavigatorWidget example (#6285)
* Add NavigatorWidget example

* Moved NavigatorWidget example into the 'Creating SubStories' tiddler

* Fixed link: NavigationMechanism => HistoryMechanism
2021-11-27 07:58:29 +00:00
Marxsal
1c4b2243a6 New tag 'KeyboardDrivenInput' on two tiddlers (#6271) 2021-11-26 17:51:39 +00:00
Mario Pietsch
c11493ec37 fix TiddlerColorFilters/default ... to return a color name or value (#6283) 2021-11-26 12:10:18 +00:00
jeremy@jermolene.com
b6c8cdae64 Merge branch 'tiddlywiki-com' 2021-11-26 11:19:28 +00:00
jeremy@jermolene.com
b80d079d71 Move docs tiddlers out of the root folder
Some of which I'd accidentally left from 1348607c8f, but I thought it was worth clearing them all up
2021-11-26 11:18:03 +00:00
btheado
6512b038c5 Added examples to compare :map filter run prefix to + prefix (#6282)
* Added examples to compare :map filter run prefix to + prefix

* Prefer ':and' over '+'
2021-11-25 18:03:30 +00:00
jeremy@jermolene.com
6d1d497a63 Tweak docs for #6268 2021-11-25 18:00:32 +00:00
Telumire
6ea7140e8f Add a snippet to visualise faulty stylesheets (#6268)
* Add a snippet to visualise faulty stylesheets

As discussed in https://github.com/Jermolene/TiddlyWiki5/issues/6176, a faulty stylesheet can propagate and break several other stylesheets. This can be tricky to debug in a wiki with a lot of custom stylesheets.

This wikitext snippet will display a list of the stylesheets created/modified by the user and will display a red cross next to the one causing a parsing error.

* Improve the css code and add a message

This commit add a short message that provide guidance on how to fix the CSS error(s).
2021-11-25 17:49:28 +00:00
btheado
7b311b0e4a Fix duplicate example id for map filter run prefix (#6281) 2021-11-25 15:20:30 +00:00
jeremy@jermolene.com
be3018fe3b Cascade: Improve demo custom story tiddler template
Now the buttons are part of the template, making it easier to manage new tiddlers given the tag $:/tags/TiddlerList

See #6280
2021-11-25 08:55:10 +00:00
jeremy@jermolene.com
68095eb392 Docs: Misc minor edits 2021-11-25 08:38:17 +00:00
jeremy@jermolene.com
4bb34e4801 Merge branch 'tiddlywiki-com' 2021-11-24 21:04:47 +00:00
jeremy@jermolene.com
1348607c8f Refactor some docs preparatory to adding the cascade docs on master branch 2021-11-24 21:04:22 +00:00
btheado
2f86779a27 Add doc tiddlers for reduce filter run prefix functionality (#6277)
* Added documentation tiddlers for reduce filter run prefix

* Make filter text box wider so long filters fit better

* removed some duplicate words

* Restored the :reduce filter run prefix tip
2021-11-24 20:02:40 +00:00
jeremy@jermolene.com
2af632a46d Don't use CodeMirror unless in the browser
Avoids crashes when rendering static tiddlers under Node.js that include edit widgets with CodeMirror.

The tiddler "SampleWindowTemplate" in 05606f72ad was triggering a build error in https://github.com/Jermolene/TiddlyWiki5/runs/4310561088?check_suite_focus=true#step:6:41
2021-11-24 10:41:38 +00:00
jeremy@jermolene.com
05606f72ad Merge branch 'tiddlywiki-com' 2021-11-24 10:07:17 +00:00
jeremy@jermolene.com
6d0701e0fa Update release note
I will add some more details about the filter cascade stuff
2021-11-23 17:31:59 +00:00
Saq Imtiaz
76cdc17f3b Support macro parameters in filter run prefixes (#6164)
* Support macro params in filter run prefixes and support substitution for variables set by filter run prefixes

* feat: add support macro parameters and variable substitution for all filter run prefixes

* fix: rename options argument to opts for disambiguation

* feat: add support for macro params to cascade filterrun prefix
2021-11-23 13:51:42 +00:00
Marxsal
7b076eadfa Tag Definition for tiddler node-webkit (#6255) 2021-11-21 22:20:13 +00:00
Marxsal
c5ce2a0a94 Tag Definition for tiddler ModuleType (#6256) 2021-11-21 22:19:54 +00:00
Saq Imtiaz
7fcc84156e Fix: issues with drag and drop in Chrome 96 (#6261)
* fix: issues with drag and drop (false positives in detection for files being dropped) introduced by Chrome 96

* fix: call dragEventContainsType method more consistently.

* fix: call dragEventContainsType method more consistently.
2021-11-21 20:48:16 +00:00
Marxsal
75bf12db7a Tags related to releases for file path (#6236)
* Tags related to releases for file path

* Tag Releases -> Release Template

Changing "Releases" tag to "Release Template"
2021-11-20 17:28:48 +00:00
Marxsal
07de96459e Tags for file paths (#6250) 2021-11-20 17:27:43 +00:00
Marxsal
be036aa9c8 Tag Demonstrations for Sample Wizard tiddlers (#6251) 2021-11-20 17:26:38 +00:00
Bram Chen
0664895670 Update chinese translations (#6249)
* Add chinese translations for `TiddlerColour/*` in ControlPanel.multids

* Fix typo
2021-11-20 16:16:54 +00:00
jeremy@jermolene.com
dde1e4bc0f Fixed missed icon and colour cascades 2021-11-20 08:55:00 +00:00
jeremy@jermolene.com
122de63b71 Add a cascade for choosing tiddler colour
Following on from #6168
2021-11-19 12:01:32 +00:00
jeremy@jermolene.com
e3ba880e18 Fix tag pill colouring
Fixes #6221
2021-11-19 10:52:13 +00:00
Marxsal
e3be15531f Adding tag 'Saving' to four IIS Examples (#6244) 2021-11-19 08:07:19 +00:00
Marxsal
5a3ff4e3dc Adding tag Definition for Osmosoft (#6247) 2021-11-19 07:55:16 +00:00
Marxsal
f7f32f00a3 Adding tag to ListopsData (#6248) 2021-11-19 07:54:43 +00:00
Marxsal
d7d694b14f tagging product badges as HelloThere Badge (#6243) 2021-11-18 18:43:23 +00:00
Cameron Fischer
a6feb6dd66 Changed vanilla/reset.tid to be a css file (#6242) 2021-11-18 18:01:13 +00:00
Marxsal
ecf10e41c3 Add tag 'Definitions' to 'BT' (#6231) 2021-11-18 09:02:05 +00:00
Marxsal
481edc1cfe Tag additions (#6233) 2021-11-18 08:58:41 +00:00
Marxsal
ff5817ab50 Tag additions - Widget Examples (#6234) 2021-11-18 08:56:36 +00:00
Marxsal
80235bf049 New tag - Message Examples (#6235) 2021-11-18 08:56:03 +00:00
Marxsal
ecddd5a7be Tags related to Mechanisms for file path (#6237) 2021-11-18 08:48:16 +00:00
Marxsal
f22fc788e5 Changing tags for NamedCommandParameters (#6238) 2021-11-18 08:47:52 +00:00
Marxsal
f828a582c3 Adding tags for file paths (#6240) 2021-11-18 08:45:20 +00:00
Cameron Fischer
a94f94f352 Trim whitespace is stylesheet viewer (#6241) 2021-11-18 08:43:15 +00:00
Marxsal
9f34a01577 Add tag 'Operator Examples' days of the week tiddler set (#6224) 2021-11-17 12:18:57 +00:00
Marxsal
9cd49ed485 Add tag 'Widget Examples' to 3 sample tiddlers (#6226) 2021-11-17 12:15:03 +00:00
Marxsal
4ea1a05af6 Add tag 'Variable Examples' to 3 tiddlers (#6227) 2021-11-17 12:14:42 +00:00
Marxsal
b6eb6d477b Message tm-open-window enhancements (#6188)
* Message tm-open-window enhancements

* Add Messages tiddler. Enhance its description.
2021-11-17 12:13:01 +00:00
jeremy@jermolene.com
cce18d8e2e Merge branch 'tiddlywiki-com' 2021-11-17 09:33:55 +00:00
Marxsal
45d469ca5c Fix tag 'Hidden Settings' on 'Hidden Setting: New-Image Type (#6225) 2021-11-16 22:41:24 +00:00
Marxsal
fbee714ffe Add tags to route to widgets file path (#6223) 2021-11-16 22:06:04 +00:00
Bram Chen
2429dcc2e2 Add chinese translations of control panel UI for inspecting template cascades (#6219) 2021-11-16 17:01:57 +00:00
Marxsal
4d84422f22 Add tag 'Macro Examples' to examples of macros (#6220) 2021-11-16 17:01:43 +00:00
jeremy@jermolene.com
d98bfbde58 Partial revert of "Add tag Demonstration to related tiddlers (#6213)"
See #6222

This reverts commit 7e32e2efcf.
2021-11-16 09:24:27 +00:00
Marxsal
983787a8f2 Tag changes to TW5 Magick and TiddlyMap Plugin (#6210) 2021-11-15 21:19:17 +00:00
Marxsal
7b83c22e78 Tag changes to Plugin Types (#6211) 2021-11-15 21:18:47 +00:00
Marxsal
c8c43b2811 Add new tag TaskManagementExample to related tiddlers (#6212) 2021-11-15 21:18:22 +00:00
Marxsal
7e32e2efcf Add tag Demonstration to related tiddlers (#6213) 2021-11-15 21:17:47 +00:00
eiro10
6f8e842105 tw5.com : Fix typo in ActionListopsWidget.tid (#6215)
* tw5.com : Fix typo in ActionListopsWidget.tid

* tw5.com : update modified field of ActionListopsWidget.tid

When editing a tiddler outside TW itself, this doesn't change automatically the modified field.
2021-11-15 21:17:10 +00:00
eiro10
ce99c0aa0f tw5.com : Fix typo in contributing.tid (#6216)
* tw5.com : Fix typo in contributing.tid

* tw5.com : update modified field of Contributing.tid

When editing a tiddler outside TW itself, this doesn't change automatically the modified field.
2021-11-15 21:16:36 +00:00
eiro10
3ff165402c tw5.com : Fix typo in list.tid (#6217)
* tw5.com : Fix typo in list.tid

* tw5.com : update modified field of list.tid

When editing a tiddler outside TW itself, this doesn't change automatically the modified field.
2021-11-15 21:15:59 +00:00
Jeremy Ruston
a350a76a00 Add "cascade" filter run prefix and use it to control view templates (#6168)
* Initial Commit

* Set currentTiddler and ..currentTiddler for filter evaulation

* Precompile the filters for performance

* Add explicit test for empty result when no filter passes

* Use the cascade filter run prefix to choose the view template body template

* Use the cascade mechanism to choose between the edit and view templates

* Simplify cascade filter

Thanks @saqimtiaz

* Add control panel UI for inspecting the template cascades

* Refactor import listing and plugin listing as alternate body templates

As suggested by @pmario

* Refer to $:/core/ui/{View|Edit}Template via their associated config tiddlers

* Fix typo in previous commit

* Add demo of custom story tiddler template

* Tweak control panel wording

* Standardise "Story Tiddler Template" nomenclature

* Add a cascade for the editor template body

* Add a cascade for the view template title

* Avoid unwanted whitespace

* Add a cascade for dynamically choosing tiddler icons
2021-11-15 21:06:47 +00:00
Marxsal
05b9dd1822 Add tag TaskManagementExample to ...Mordor... (#6218) 2021-11-15 18:40:08 +00:00
Saq Imtiaz
5207b1c127 Docs: add node.js related tag to relevant tiddlers (#6205) 2021-11-14 15:47:45 +00:00
Saq Imtiaz
267c351735 Docs: add "Widgets" tag to new docs tiddlers (#6195) 2021-11-14 15:47:19 +00:00
eiro10
f545418e55 Signing the CLA (#6206) 2021-11-14 15:45:10 +00:00
Marxsal
97dd832d2e More tag changes for file routing (#6199) 2021-11-14 09:12:19 +00:00
Marxsal
d7e7d87581 Add Filter tag to The Extended Listops Filters (#6201) 2021-11-14 08:47:53 +00:00
Marxsal
bd2efeaaa3 Add new tag 'Table-of-Contents Demonstrations' (#6202) 2021-11-14 08:47:07 +00:00
Marxsal
a206bf56b9 Add new tag 'GettingStarted' to Getting Started Tiddlers (#6204) 2021-11-14 08:42:43 +00:00
Marxsal
a33e94c4ee Correct tag names. Add missing tags (#6193)
* Correct tag names. Add missing tags

* Update _muritest_ by Simon Huber.tid

Auto PR didn't include this.

* Update _TiddlyServer_ by Matt Lauber.tid

Fixing tag
2021-11-13 08:48:52 +00:00
Saq Imtiaz
e9313b1c9d Update Hidden Setting_ Typin Refresh Delay.tid (#6187) 2021-11-09 19:44:15 +00:00
twMat
8096935d87 Update DateFormat.tid (#6186)
Ref [discussion](https://talk.tiddlywiki.org/t/help-me-improve-the-dateformat-doc)
2021-11-09 19:16:25 +00:00
Marxsal
dcb083abb0 Add example of actions attribute to SelectWidget documentation (#6181) 2021-11-08 16:59:17 +00:00
Telumire
6cc76fe6ab Update the tiddler "Simple ways to write protect tiddlers" to use data-tags (#6175) 2021-11-06 08:14:36 +00:00
Marxsal
4f8de1881c Increase specificity of doc-examples input (#6174) 2021-11-05 18:09:53 +00:00
jeremy@jermolene.com
9caba544eb Fix refreshing of codeblock widget
Fixes #6171
2021-11-05 08:28:56 +00:00
Marxsal
746a8ca17f Restore some docs re EditTextWidget (#6170) 2021-11-04 20:39:53 +00:00
jeremy@jermolene.com
2475e1b501 Merge branch 'tiddlywiki-com' 2021-11-04 20:34:01 +00:00
Marxsal
193628d63f Add note about exporting variables to 'Environmental Variables on Node.js' (#6169) 2021-11-04 17:53:09 +00:00
Saq Imtiaz
b6ce353a7d Fix: resolved search-replace operator regexp encoding bug (#6162)
* fix: resolved search-replace operator bug with $ character in replacement strings, added test and more examples

* fix: reset regexp after each title
2021-11-01 13:24:30 +00:00
btheado
7a50603d9d Added MessageHandlerWidgets and TriggeringWidgets tags (#6161) 2021-11-01 12:56:52 +00:00
btheado
d21fabca4b Docs: Fix filters selection constructors tag (#6154)
Add constructor tag to these filter operators:
* deserializers
* range
* storyviews

Remove constructor tag from
* enlist-input
2021-10-31 10:36:45 +00:00
btheado
daa9a8ae45 Add subfilter operator examples and mention when it is a constructor (#6155) 2021-10-31 10:36:03 +00:00
btheado
d9eb5499a3 Ensure the operator examples have unique id (#6153)
The first parameter of the operator examples macro is used for
constructing unique state tiddler titles. The cycle, log, and
match operators had duplicates, causing examples to share state
with each other.
2021-10-30 15:54:57 +01:00
jeremy@jermolene.com
870c7897ad Fix docs typos 2021-10-30 15:28:54 +01:00
jeremy@jermolene.com
95da1c2907 Update release note 2021-10-30 11:44:58 +01:00
Cameron Fischer
2bfe522b72 Add $let widget (#6148)
* $let widget added and tested

* Documentation for $let, doc improvements for $vars

* let properly avoids refreshing when possible

* $let Changes as recommended by others

* Removed superfluous super method call

Also improved $let test
2021-10-30 11:42:22 +01:00
Saq Imtiaz
c099bf9893 Extends :map filter run prefix to provide missing variables (#6149)
* Extends :map filter run prefix to provide the variables index, revIndex and length to bring it into line with :reduce

* update :maps examples

* docs: fix formatting issue with documentation
2021-10-30 10:04:50 +01:00
jeremy@jermolene.com
ab0dda1177 Merge branch 'tiddlywiki-com' 2021-10-30 09:54:55 +01:00
Saq Imtiaz
4f65953da9 Added zero based zth[] operator and documentation (#6150) 2021-10-30 09:52:38 +01:00
jeremy@jermolene.com
d77de61a06 Update docs for per-tiddler preview pane 3287cf56bb 2021-10-29 10:04:08 +01:00
Simon Huber
3287cf56bb Make editor-preview open on a per-tiddler basis (#5998)
* make editor-preview open on a per-tiddler basis

* use qualified state for showeditpreview

* fix added p tag

* Make tiddler-preview per-tiddler configurable

* Create ShowEditPreviewPerTiddler.tid

* Update ControlPanel.multids

* Create ShowEditPreviewPerTiddler.tid

* Update body.tid

* Update ShowEditPreviewPerTiddler.tid

* Update ControlPanel.multids

* Delete ShowEditPreviewPerTiddler.tid

* Delete ShowEditPreviewPerTiddler.tid

* Create Hidden Setting ShowEditPreviewPerTiddler.tid
2021-10-28 19:17:15 +01:00
Saq Imtiaz
b5c81d2721 Provide actionValue variable to actions fired by EditTextWidget (#6145)
* feat: provide actionValue variable to actions fired by EditTextWidget

* also extend CodeMirror engine to set actionValue variable when invoking actions
2021-10-28 19:15:50 +01:00
Maurycy Zarzycki
d3522854b6 Polish translation fixes (#6144)
* fix word used for the sidebar's "Open" tab header

"Otwórz" is a verb (to open), while "Otwarte" is an adjective (the ones which are open)

* fix "shadow tiddler" declension

* fix declension

* fix missing space

* fix declension

* fix invalid plugin version message to read better

Co-authored-by: Maurycy Zarzycki <maurycy@evidentlycube.com>
2021-10-28 09:59:27 +01:00
jeremy@jermolene.com
2f3f9de7be Fix typo in d5f72cb282
Fixes #6143
2021-10-28 09:18:54 +01:00
Simon Huber
6890952357 Make image-picker in theme tweaks not dismiss popup ... (#6015)
when clicking the system-images checkbox
2021-10-27 14:13:49 +01:00
Simon Huber
d695fca301 Add focus-editor text operation and use it where sensible (#6012)
* add and use focus-editor text operation

* add docs
2021-10-27 11:37:40 +01:00
Simon Huber
a0d2392f01 Update link-widget refresh method (#6013)
* update link-widget refresh method

* update link-widget refresh method
2021-10-27 11:37:08 +01:00
Jeremy Ruston
23b4e03cd5 Extend HTML tag parser to maintain an ordered array of attribute names (#6132)
* Extend HTML tag parser to maintain an ordered array of attribute names

* Add some tests for repeated attributes

* Record entire attribute in orderedAttributes array so that we can work with duplicated attributes
2021-10-27 11:35:12 +01:00
Jeremy Ruston
d5f72cb282 Set multiple fields/variables/params using filters (#6130)
* Add action-setmultiplefields and setmultiplevariables, and extend action-sendmessage

* Add getfield operator

* Remove getfield operator

See discussion at https://github.com/Jermolene/TiddlyWiki5/pull/6130#issuecomment-949911439

* Add docs

* Adjust whitespace

* Add support for assigning multiple indexes to action-setmultiplefields
2021-10-27 11:20:11 +01:00
jeremy@jermolene.com
5f57bf81cd Merge branch 'pr/4977' 2021-10-27 11:18:57 +01:00
Joshua Fontany
e32c9e4658 Feature tiddlywiki.files "searchSubdirectories" flag (#5275)
* experimenting

* recurse flag for directories in tiddlywiki.files

* searchSubdirectories docs

* filesystem cleanup to seperate PR

* cleanup

* improved docs
2021-10-27 11:16:05 +01:00
Joshua Fontany
2a73505508 Fix overwriting of modification fields when PUTting a tiddler #6075 (#6084)
* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* fix PUT bug with created/modified fields
2021-10-27 11:15:30 +01:00
jeremy@jermolene.com
4d87ef4231 Add a comment on the default value of tv-action-refresh-policy 2021-10-26 09:51:00 +01:00
jeremy@jermolene.com
71be167592 Clarify ActionWidget Execution Modes to include default value 2021-10-26 09:50:02 +01:00
Telumire
c543036a0f Add missing parameter to atan2 operator (#6142)
* Added missing trigonometrics filter operators

This PR adds support to trigonometry operators, allowing to create spider graphs and other geometric shapes with filters.

* Adds the missing trigonometric filter operators

This PR adds support to the missing trigonometric filter operators (cos, sin, tan, acos, asin, atan, atan2), allowing to create spider graphs, [pie charts, donut charts, polar charts](https://ffoodd.github.io/chaarts/pie-charts.html) and other geometric shapes with filters, which was previously not possible without add-ons.

Example :

`[[2]cos[]] = -0.4161468365471424`

See also this radar chart made in wikitext by @saqimtiaz using the new trigonometric operators :
https://saqimtiaz.github.io/sq-tw/temp/radar-chart-demo.html

* Add documentation for the Trigonometric Operators 

Accompanies code changes #6127

* Fix formatting of atan2 Operator.tid

Removed two empty lines at the end of the tiddler

* Add examples for the trigonometric operators 

Accompanies code changes Jermolene#6127

* Fix version in the doc for trigonometric operators

This PR fix the content of the documentation tiddlers regarding trigonometric operators (#6131). 

<<.from-version "5.1.20">> was changed to <<.from-version "5.1.21">>

* Fix formatting of atan2 Operator.tid

Removed two empty lines at the end of the tiddler

* Add missing parameter to atan2 operator

The atan2 operator needs two parameters (Binary Mathematics Operators), this PR adds the second one that was missing.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan2 for more technical info on the atan2 function.
2021-10-25 21:13:18 +01:00
btheado
989947b99a Make filter operater examples live-editable (#6139)
* Make filter operator examples easily editable

* Add 'Reset' button to filter operator examples

* Only display the reset button when filter has changed

* Introduce '.doc-example input' class rather than re-use tc-advanced-search to make input wider

* Grab focus for the filter text box

* Fix firefox ctrl-z/undo issue by replacing list widget with filter transclusion

* Replace spaced indent with tabs to make it consistent with the other code
2021-10-25 16:35:57 +01:00
jeremy@jermolene.com
3d86d62a6e Minor tweaks to 0cfe6597d4 2021-10-25 16:29:53 +01:00
Mario Pietsch
0cfe6597d4 Add new improved "Icon Gallery" (#6112)
* add a core icon selector to the docs

* Add Icon Gallery and improve links to expose the function

* re-add the ImageGallery Example tiddler
2021-10-25 16:23:57 +01:00
jeremy@jermolene.com
8ae4428332 Fix $timestamp ignored for action-setfield widget when setting index values 2021-10-24 20:19:42 +01:00
Marxsal
81b4e99ccc Update LazyLoading.tid (#6099) 2021-10-22 14:35:25 +01:00
Telumire
2f133a08aa Add documentation and examples for the trigonometric filter operators (#6131)
* Added missing trigonometrics filter operators

This PR adds support to trigonometry operators, allowing to create spider graphs and other geometric shapes with filters.

* Adds the missing trigonometric filter operators

This PR adds support to the missing trigonometric filter operators (cos, sin, tan, acos, asin, atan, atan2), allowing to create spider graphs, [pie charts, donut charts, polar charts](https://ffoodd.github.io/chaarts/pie-charts.html) and other geometric shapes with filters, which was previously not possible without add-ons.

Example :

`[[2]cos[]] = -0.4161468365471424`

See also this radar chart made in wikitext by @saqimtiaz using the new trigonometric operators :
https://saqimtiaz.github.io/sq-tw/temp/radar-chart-demo.html

* Add documentation for the Trigonometric Operators 

Accompanies code changes #6127

* Fix formatting of atan2 Operator.tid

Removed two empty lines at the end of the tiddler

* Add examples for the trigonometric operators 

Accompanies code changes Jermolene#6127

* Fix version in the doc for trigonometric operators

This PR fix the content of the documentation tiddlers regarding trigonometric operators (#6131). 

<<.from-version "5.1.20">> was changed to <<.from-version "5.1.21">>

* Fix formatting of atan2 Operator.tid

Removed two empty lines at the end of the tiddler
2021-10-22 11:35:47 +01:00
jeremy@jermolene.com
6b17e688da Merge branch 'tiddlywiki-com' 2021-10-21 09:21:29 +01:00
jeremy@jermolene.com
8654066f03 Remove docs about editing a field of the containing tiddler
Doesn't apply post v5.2.0
2021-10-21 09:21:00 +01:00
Joshua Fontany
56dae90425 Fix $tw.utils.decodeURISafe and $tw.utils.decodeURIComponentSafe not available during boot process (#6107)
* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* fix 5999 URI utils bug
2021-10-20 16:25:05 +01:00
Telumire
1f6ef07860 Add trigonometric filter operators (#6127)
* Added missing trigonometrics filter operators

This PR adds support to trigonometry operators, allowing to create spider graphs and other geometric shapes with filters.

* Adds the missing trigonometric filter operators

This PR adds support to the missing trigonometric filter operators (cos, sin, tan, acos, asin, atan, atan2), allowing to create spider graphs, [pie charts, donut charts, polar charts](https://ffoodd.github.io/chaarts/pie-charts.html) and other geometric shapes with filters, which was previously not possible without add-ons.

Example :

`[[2]cos[]] = -0.4161468365471424`

See also this radar chart made in wikitext by @saqimtiaz using the new trigonometric operators :
https://saqimtiaz.github.io/sq-tw/temp/radar-chart-demo.html
2021-10-19 15:56:08 +01:00
Telumire
f30a455ee3 Signing the CLA (#6128)
see https://github.com/Jermolene/TiddlyWiki5/pull/6127
2021-10-18 09:06:49 +01:00
btheado
03bd99cd11 Docs: fix invalid html comment in operator template #6100 2021-10-11 12:01:34 +01:00
btheado
cc389ec82b Improve $action-listops attribute docs (#6104)
* Added comparisons of $filter, $subfilter, and $tags attributes

* Added comparison between action-listops and action-setfield widgets
2021-10-11 11:59:47 +01:00
btheado
f85678b6dc Signing the CLA (#6103) 2021-10-11 11:52:29 +01:00
Marxsal
8d7c869072 Changes to TiddlyServer by Matt Lauber (#6094)
This version of the project is not maintained. I've noted this and added a link to Arlen Beiler's community reference. I suppose it could be deleted entirely, but might be useful for historical purposes?
2021-10-08 19:09:17 +01:00
Marxsal
8f592d3f0a Documentation - Installing Nodejs fixes (#6085) 2021-10-04 09:48:44 +01:00
jeremy@jermolene.com
1f2e0ed189 Placeholder banner image for v5.2.1 2021-10-03 16:17:15 +01:00
jeremy@jermolene.com
4d6c428ba9 Preparation for v5.2.1-prerelease 2021-10-03 15:46:25 +01:00
jeremy@jermolene.com
d095aa0182 Version number update for 5.2.0 2021-10-03 15:29:21 +01:00
jeremy@jermolene.com
15bf850280 Update plugin library for prerelease 2021-10-03 15:28:40 +01:00
jeremy@jermolene.com
62b273266e Update readme.md and contributing.md for v5.2.0 2021-10-03 15:26:45 +01:00
jeremy@jermolene.com
1d058177be Move v5.2.0 release note and prepare v5.2.1 release note 2021-10-03 15:25:36 +01:00
jeremy@jermolene.com
14676b345a Update modified dates for release note and hellothere 2021-10-03 15:21:02 +01:00
jeremy@jermolene.com
a50e6eed38 Merge branch 'tiddlywiki-com' 2021-10-03 15:12:55 +01:00
Saq Imtiaz
073a064ae8 Fixed typo in relese notes (#6083) 2021-10-03 15:11:03 +01:00
jeremy@jermolene.com
e00a3d3cb4 Update release note with an "Other Notable Improvements" section 2021-10-03 13:06:08 +01:00
jeremy@jermolene.com
68d9200a6b Breakup the action widgets execution modes documentation 2021-10-03 13:05:48 +01:00
jeremy@jermolene.com
2551bb3e3f Update release note 2021-10-03 11:40:35 +01:00
jeremy@jermolene.com
80b18e6315 Update JSON store area docs 2021-10-03 11:40:27 +01:00
Maurycy Zarzycki
e0561397f1 Added Polish translation (#6079)
* add Polish translation

* tweak Polish translations to make certain things moree readable

primarily changed translation of "story river" to keep using the English
phrase, but also some other phraes that were awkward when I used the
translation

* add polish flag icon

* add polish translation notes

* replace 'ukryte tiddlery' with 'tiddlery-cienie'

Co-authored-by: Maurycy Zarzycki <maurycy@evidentlycube.com>
2021-10-03 09:19:48 +01:00
jeremy@jermolene.com
b9c3c38edc List widget: Clarify performance optimisation impact of counter attribute 2021-10-02 18:27:50 +01:00
lin onetwo
077ced0d1a Fix: add text to QR Code button caption (#6082) 2021-10-02 18:09:11 +01:00
jeremy@jermolene.com
e5ff84035c Minor fixes to introduction edition 2021-10-02 17:31:02 +01:00
jeremy@jermolene.com
e18a983209 Update dynaview demo viewtemplate with latest core changes 2021-10-02 17:22:24 +01:00
jeremy@jermolene.com
6f61fa07fb Update view template to use whitespace trim 2021-10-02 17:22:10 +01:00
jeremy@jermolene.com
d5d73e02e9 Fix bug with innerwiki template
The problem was that the innerwiki template included the tiddler $:/plugins/tiddlywiki/railroad, which was omitted from the wiki. Unexpectedly, missing tiddlers were rendered by the jsontiddler widget as an empty object {}. The fix is to always include the title when the tiddler is missing.

Also cleaned up the template to remove unneeded tiddlers
2021-10-02 16:17:07 +01:00
Maurycy Zarzycki
4ba7454d8d Signing the CLA (#6078) 2021-10-01 13:26:00 +01:00
Mario Pietsch
5192a39830 Update German translations (#6077) 2021-09-30 15:46:33 +01:00
jeremy@jermolene.com
aa5413b942 Fix incomplete sentence in MessageCatcherWidget docs 2021-09-30 10:34:27 +01:00
Xavier Cazin
ef284e9bde Update the Android section in Saving via WebDAV (#6069) 2021-09-28 10:22:35 +01:00
Cameron Fischer
9c41fe1d18 JSONTiddler a little more extensible (#6057)
As per discussion #6043
2021-09-27 14:23:52 +01:00
jeremy@jermolene.com
e577cf7302 Render command: verbose mode should print title before rendering
Fixes #6067
2021-09-24 18:40:34 +01:00
jeremy@jermolene.com
ebf563ac70 Additional transliteration pairs
Fixes #6066
2021-09-24 18:29:40 +01:00
jeremy@jermolene.com
909340c6fe Release note tweaks 2021-09-24 12:15:19 +01:00
jeremy@jermolene.com
df6d38df65 Update release note 2021-09-24 12:00:07 +01:00
jeremy@jermolene.com
59a53e695b Further refine date format tokens for day of year and weekday number
See f223896c26
2021-09-23 10:09:27 +01:00
jeremy@jermolene.com
6d17505f7b Fix typo in DateFormat docs 2021-09-23 07:41:06 +01:00
Jeremy Ruston
36dd8ea1d2 Optimise wiki.sortTiddlers() (#6053)
* Optimise wiki.sortTiddlers()

* Remove local changes to test-filters.js that have now been made on master

Makes the subsequent merge easier

* Fix bug with numeric sorts of textual values
2021-09-22 13:44:35 +01:00
Saq Imtiaz
b965ae926b Fix(action-confirm): check if event is defined before accessing its properties (#6063) 2021-09-22 13:43:02 +01:00
jeremy@jermolene.com
f6eadbd1c9 Fix crash with reading invalid JSON files 2021-09-22 12:56:55 +01:00
jeremy@jermolene.com
bdbb884be0 MessageCatcher: Fix stack overflow when re-issuing a trapped message
This makes it possible to trap a message and then re-issue the same message within the action string without an infinite loop.
2021-09-20 16:46:26 +01:00
jeremy@jermolene.com
0be39cfbc2 More sorting tests to help with #6053 2021-09-20 11:04:37 +01:00
Saq Imtiaz
ef2aeac7de Added modulesproperty filter operator and extended modules operator (#6055)
* Added modulesproperty filter operator and extended modules operator. Docs included

* Removed spurious new line
2021-09-20 08:25:53 +01:00
Cameron Fischer
157afda2fc Change backlinks to use LinkedList (#6050) 2021-09-19 19:58:45 +01:00
jeremy@jermolene.com
fb4d77ef46 Improved fix for #5701
Reverts dbd3f835bf

Fixes #6042
2021-09-19 13:28:58 +01:00
Cameron Fischer
575c233597 Update untagged filter to avoid $tw.utils.pushTop (#6034) 2021-09-18 16:47:46 +01:00
Saq Imtiaz
2e59d770f7 Fix eventcatcher widget: check for event properties before accessing (#6048) 2021-09-18 15:08:15 +01:00
Soren Bjornstad
baf0ee9cde Remove stray characters in example of :map prefix (#5963)
The `get[` here isn't valid and looks like a copy-paste error.
2021-09-18 15:04:50 +01:00
Soren Bjornstad
af89bb591d Sign CLA (#6049) 2021-09-18 15:03:42 +01:00
Mario Pietsch
d0dec741ad katex-plugin: fix #6041 add automatic numbering reset to KaTex style-sheet (#6046)
* katex-plugin: fix #6041 add automatic numbering reset to KaTex style-sheet

* fix typo
2021-09-18 09:45:17 +01:00
jeremy@jermolene.com
33a82e395e Revert tiddlylink font weight to match v5.1.23
Otherwise links to missing tiddlers are too skinny
2021-09-17 15:11:29 +01:00
jeremy@jermolene.com
f223896c26 Refine date format tokens for weekday number, and add support for day of year
See discussion at https://groups.google.com/g/tiddlywiki/c/tf23ByDXzxM/m/5Wx7PV36AwAJ
2021-09-17 14:52:08 +01:00
Saq Imtiaz
de33b365ae Fixed refresh bug with radio widget where the tc-radio-selected class is not correctly updated (#6044) 2021-09-17 12:52:27 +01:00
Cameron Fischer
e9d8547a81 Optimise LinkedList filter ops to return iterator instead of array (#6035)
* filter ops don't LinkedList to array anymore

* LL.tiddlerIterator -> LL.makeTiddlerIterator

LinkedList method name change.
2021-09-16 22:22:44 +01:00
Cameron Fischer
dcff318a98 Fix wiki.eachShadow returns overridden sources (#6036)
It was returning the underlying shadows before, even if overridden, which
was causing some bugs.

Fixes #6033
2021-09-16 20:08:11 +01:00
jeremy@jermolene.com
f725123690 Simplify freelinks regexp
As discussed here: https://github.com/Jermolene/TiddlyWiki5/issues/6029#issuecomment-917612980
2021-09-14 10:22:27 +01:00
jeremy@jermolene.com
e9e5d37ff0 Draggable widget: Add option to hide drag image
Thanks @ericshulman

Fixes #6027
2021-09-12 14:20:03 +01:00
jeremy@jermolene.com
f70cee6907 Add new date format tokens for weekday number
See https://en.wikipedia.org/wiki/ISO_8601#Week_dates
2021-09-12 11:53:46 +01:00
jeremy@jermolene.com
1491339f50 Update KaTeX version number 2021-09-12 10:56:39 +01:00
jeremy@jermolene.com
8a5ed59ff4 Release note update for KaTeX 2021-09-12 10:55:33 +01:00
jeremy@jermolene.com
a2ca5e4d1e Update KaTeX to v0.13.18 2021-09-12 10:54:54 +01:00
jeremy@jermolene.com
fba993502d Revert some of the UI changes for downloading external-js
See https://github.com/Jermolene/TiddlyWiki5/pull/5570#issuecomment-892127428
2021-09-12 10:48:17 +01:00
jeremy@jermolene.com
9fae3a932b Release note: Emphasise more flexible parsing of macros 2021-09-12 09:07:15 +01:00
Jieao Song
62610f0666 Add custom macro editor for KaTeX plugin (#5933)
* Add custom macro editor for KaTeX plugin

* Use list

* Better escape

* Tweaks

* Remove const

* Catch bad macros

* Capitalize tags

* Name KaTeX-macro tiddlers properly

* UI tweaks

* Move input string to temp

* Improve UI; import macros using LaTeX cmd directly
2021-09-10 21:28:13 +01:00
Cameron Fischer
7282ec5286 Fix getCacheForTiddler to cache falsy values (#5413)
* getCacheForTiddler can cache falsy values

* Switch to "!== undefined" for getCacheForTiddler
2021-09-10 21:17:35 +01:00
Simon Huber
9830e0104f Fix the EditTabIndex value applied to DomNodes which was '1\n' (#6022) 2021-09-08 14:50:11 +01:00
jeremy@jermolene.com
e6fd0caf6b Update range operator to use multiple operands
We still also support the old way of packing all three parameters into one operand with a delimiter
2021-09-07 17:16:09 +01:00
jeremy@jermolene.com
137df37bc7 Merge branch 'tiddlywiki-com' 2021-09-07 11:02:03 +01:00
Bram Chen
d895706199 Revise chinese translations in Imports.multids (#6024) 2021-09-06 08:16:14 +01:00
Xavier Cazin
6ed7d418b5 A few updates to the fr-FR translation + a typo correction in core Imports.multids (#6023) 2021-09-05 19:51:48 +01:00
jeremy@jermolene.com
62b8a83741 Avoid MSIE crash
Fixes #6014
2021-09-01 09:56:17 +01:00
Marxsal
e795b501ac Update Saving via WebDAV (#6011) 2021-08-31 09:19:10 +01:00
Marxsal
03228d8d20 Allow compare operator to appear on filter list (#6008) 2021-08-30 08:58:26 +01:00
jeremy@jermolene.com
c9c5d4cf79 Remove new docs from #5648
See https://github.com/Jermolene/TiddlyWiki5/pull/5648#issuecomment-907845331
2021-08-29 19:36:23 +01:00
Simon Huber
f5cc5bc6a1 Make stamp-dropdown items that are suffixed and prefixed ... (#6003)
... work for shadow tiddlers, too
2021-08-29 18:04:32 +01:00
Mario Pietsch
447494ad4d Fix some typos in the ViewTolbar button docs (#5974)
* fix some typos in the ViewTolbar button docs

* add missing fields to shadow. closes #5980
2021-08-29 17:50:28 +01:00
Simon Huber
c9f178ec87 Make Stamp-Dropdown sortable by Drag&Drop (#5981)
* Make stamp-dropdown reorderable by list-tagged-draggable macro

* Add stamp-dropdown ItemTemplate tiddler

* Make stamp-entries editable by ctrl-click

* Update stamp-dropdown-item-template.tid

* Add `tc-editortoolbar-stamp-button` class to stamp button

* Make stamp-dropdown look like before

* Update base.tid
2021-08-29 17:48:32 +01:00
jeremy@jermolene.com
33be326ef6 Add from-version banner to search-replace operator "m" flag 2021-08-29 17:45:59 +01:00
Simon Huber
c13f04d838 Add m flag for multiline matches to search-replace filter operator (#5968)
* add m flag to search-replace operator and add tests

* update documentation

* Update test-filters.js

* Update test-filters.js

* Update search-replace Operator (Examples).tid

* Fix "Hello There" title (HelloThere)
2021-08-29 17:44:34 +01:00
Mohammad Rahmani
737685149c Plugins tab in control panel display tabs using tag filter instead of hardcoded list (#5694)
* Plugins tab in control panel display tabs using filter instead of hard coded list

* Update ControlPanelPlugins.tid

The two entries `[[$:/core/ui/ControlPanel/Plugins/Installed]] [[$:/core/ui/ControlPanel/Plugins/Add]]` were removed from list filed as per @Jermelon confirmation!

* Create SystemTag_ $__tags_ControlPanel_Plugins.tid

Update the SystemTags documentation tiddler
2021-08-29 17:35:18 +01:00
Joshua Fontany
33eef0202d Adds $tw.utils.decodeURISafe and $tw.utils.decodeURIComponentSafe (#5999)
* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* fixes decodeURI & decodeURIComponent
2021-08-29 13:39:32 +01:00
jeremy@jermolene.com
a67b1b8bb5 Fileserver: Check for valid file paths 2021-08-28 13:16:54 +01:00
jeremy@jermolene.com
124b49456a MessageCatcher: Expose lists of the message property names 2021-08-21 12:50:38 +01:00
Saq Imtiaz
24956087cc Do not add X-Requested-With header for simple requests (#5931) 2021-08-17 09:56:52 +01:00
jeremy@jermolene.com
199ca57f1c Release note tweaks 2021-08-15 18:13:02 +01:00
jeremy@jermolene.com
64d53ac533 Release note: Optimised Refreshing of Transclusions
A first attempt to write up the consequences, including the impact on broken JS macros. The problem is that there's not really a simple fix that we can give.

The best I can think of is not good enough: a $:/config/ tiddler that globally controls whether the transclude widget uses the new selective refreshing.
2021-08-15 13:17:59 +01:00
Cameron Fischer
b3accbf9e0 Fakedom: use text encoder for html text (#5950) 2021-08-12 16:46:11 +01:00
Joshua Fontany
99249a3160 Fix syncer logout alert (#5936)
* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* fix Syncer logout alert
2021-08-05 14:50:22 +01:00
Jieao Song
f7cd8bad3a Signing the CLA (#5938) 2021-08-05 14:42:28 +01:00
jeremy@jermolene.com
e9613d7f12 eventcatcher widget: Add viewport-relative coordinates
This is useful because we get viewport relative coordinates from the link and action-navigate widgets
2021-08-05 08:35:44 +01:00
jeremy@jermolene.com
97dff042f7 Reveal widget: fix crash when popup tiddler is refreshed but the popup is not displayed 2021-08-04 17:00:42 +01:00
jeremy@jermolene.com
32b36fb2af Update New Release Banner with winning artwork from Frank B 2021-08-04 11:58:04 +01:00
jeremy@jermolene.com
41535150dd Fix docs typos in "Customising Tiddler File Naming" 2021-08-03 20:47:44 +01:00
jeremy@jermolene.com
8e69284e8c Updated Catalan translation from Paco Riviere 2021-08-01 15:19:14 +01:00
jeremy@jermolene.com
61cfac4eeb Fix typo in release note
Thanks @twMat
2021-07-30 16:33:00 +01:00
jeremy@jermolene.com
2720072b23 Text editor: fix crash when assigning new value to file input controls
Fixes #5911
2021-07-30 16:31:42 +01:00
Joshua Fontany
0413c3a38e Fix syncer error handling for getStatus (#5914) 2021-07-30 16:21:02 +01:00
Mario Pietsch
f2b30c1fe0 tabs-macro: improve info about the "default" parameter (#5904) 2021-07-30 16:19:23 +01:00
Simon Huber
3c86cf7d2e Add pop storyview to ViewToolbar buttons (#5910)
* Add pop storyview to ViewToolbar buttons

* Update title.tid
2021-07-30 16:11:27 +01:00
jeremy@jermolene.com
451074f7ed Fix typo in release note
Thanks @twMat
2021-07-29 12:41:26 +01:00
Saq Imtiaz
1e5601ca31 Fix inaccuracies in documentation for duplicateslugs[] (#5918) 2021-07-29 11:39:20 +01:00
jeremy@jermolene.com
75c99cd235 Merge branch 'tiddlywiki-com' 2021-07-27 19:33:36 +01:00
jeremy@jermolene.com
bb2c2be9b6 Remove file erroneously committed in c4a7ae3164 2021-07-27 19:33:20 +01:00
jeremy@jermolene.com
53c247b9a1 Merge branch 'tiddlywiki-com' 2021-07-27 19:30:44 +01:00
Mario Pietsch
82667d9d16 Add indentation to $:/core/ui/Components/plugin-info (#5777)
* Add indentation to plugin-info, to make the macros readable.

* add missing indent
2021-07-26 21:59:02 +01:00
Bram Chen
97ed2757f0 Revise chinese translations (#5915) 2021-07-26 14:31:43 +01:00
jeremy@jermolene.com
19fd5ca5f2 Remove erroneous \s from field name check
Fixes #5905
2021-07-22 16:55:17 +01:00
jeremy@jermolene.com
6ae78a770f Fix erroneous bolding of links
An accident from f97850dd05
2021-07-19 14:03:12 +01:00
jeremy@jermolene.com
04962b4cd6 Update release note 2021-07-19 12:56:18 +01:00
jeremy@jermolene.com
f97850dd05 Update "Snow White" font-family and font-weight
Fixes #5896
2021-07-19 12:54:57 +01:00
jeremy@jermolene.com
2cb3ed3ab9 Change tab switching shortcuts to alt-ctrl-left/right
Fixes #5889
2021-07-16 13:06:49 +01:00
jeremy@jermolene.com
a4421f50c6 Git{hub|ea|lab} saver should wikify commit messages
Proposed in discussion https://github.com/Jermolene/TiddlyWiki5/discussions/5886#discussioncomment-1012593
2021-07-16 12:04:05 +01:00
Saq Imtiaz
cb726f40fa Fix: bug with List Widget where the counter-last variable is not always accurately updated on refresh (#5883) 2021-07-15 21:59:07 +01:00
Arlen22
be026aa308 Revert "Add server sent events (#5279)" (#5880)
This reverts commit 17b4f53ba2 according to Github Desktop.

git checkout that commit
revert commit in GitHub Desktop
git switch -c revert-sse
uncommit in Github Desktop
switch to master, bringing changes
resolve deletions with command line
2021-07-14 17:16:57 +01:00
RJ Skerry-Ryan
b95f6ca084 Signing the CLA (#5847) 2021-07-04 11:57:38 +01:00
twMat
4a7f078abd Update qualify.tid (#5845)
superfluous blockquoting
2021-07-03 17:43:20 +01:00
Tejasvi S. Tomar
54d8b8a373 Correct term usage (#5417) 2021-06-29 12:24:09 +01:00
GHSRobert Ciang
dd6bd58140 Update TiddlyWiki in the Sky for Dropbox.tid (#5832) 2021-06-29 12:09:16 +01:00
Álvaro González Rincón
4c56bd771a Signing the CLA (#5794) 2021-06-14 17:42:26 +01:00
Frank
a70b26cd55 Sign the CLA (#5774) 2021-06-09 21:32:31 +01:00
jeremy@jermolene.com
c4a7ae3164 Add demo of drag and drop from a standalone HTML file 2021-06-03 14:14:11 +01:00
Joe Bordes
8b8f654c9c Signing the CLA (#5730) 2021-05-30 18:47:34 +01:00
Miha Lunar
9b247f6d63 Removed fallback range logic 2021-05-29 20:30:04 +02:00
Mario Pietsch
f342fdc41d improve setwidget examples and add a link to and from enlist operator (#5666) 2021-05-25 22:19:28 +01:00
Mario Pietsch
ca96f7f62b contain the long list inside a div which is 50% of vertical height (#5385) 2021-05-25 22:19:09 +01:00
Saq Imtiaz
2f31eab8f4 Update docs for tabs macro (#5722) 2021-05-25 22:16:02 +01:00
Saq Imtiaz
c8528fd1f7 Update keyboard-driven-input_Macro.tid (#5712) 2021-05-21 10:02:35 +01:00
Chris Nicoll
07ac85d9fa Add demo for keyboard-driven-input (#5710) 2021-05-21 09:54:11 +01:00
jeremy@jermolene.com
e84f214280 Add link to @sobjornstad's "Grok TiddlyWiki" 2021-05-19 11:08:48 +01:00
ualich
9cd65efad9 Signing the CLA (#5671) 2021-05-06 12:24:08 +01:00
Chris Nicoll
41200ab6d7 Fix #5310: docs for unique[] filter operator (#5651)
Co-authored-by: clutterstack <clutterstack@gmail.com>
2021-04-29 13:14:28 +01:00
Miha Lunar
62fdaa633a Fixed fallback range logic + added ranges to tests 2021-04-25 16:03:35 +02:00
Miha Lunar
79f5e6b498 Merge remote-tracking branch 'origin/master' into parser-ranges 2021-04-25 13:17:44 +02:00
Miha Lunar
23bd7e7817 Replaced restructuring and added fallback comment 2021-04-25 13:12:45 +02:00
Simon Baird
792171c8fc Two typo fixups related to surplus tilde chars (#5627) 2021-04-24 15:42:02 +01:00
Simon Baird
051a468c63 Add info on TiddlyHost saving & revised TiddlySpot (#5622)
I updated the English text only. Will need some help with the
translations.

Summary:
- Mention that TiddlySpot is deprecated and doesn't allow site
  creation any more. Suggest using TiddlyHost instead.
- Remove obsolete intructions about creating TiddlySpot sites.
- Misc editing/rewording/tweaking of existing TiddlySpot info
  for tidiness and clarity.
- Add new information about saving on TiddlyHost.
- Add logos because why not..

Note: I usually prefer the non-camel case versions of Tiddlyspot and
Tiddlyhost, but decided to go with the CamelCase WikiWords here to
fit in with the existing conventions.
2021-04-23 17:45:44 +01:00
Miha Lunar
1b226c7556 Fixed coding standard nits 2020-11-06 19:56:20 +01:00
Miha Lunar
2bd9cc45fa Added more start/end parser ranges 2020-11-04 21:02:17 +01:00
782 changed files with 14358 additions and 5286 deletions

View File

@@ -1,15 +1,8 @@
# Known minified files
# Ignore "third party" code whose style we will not change.
/boot/sjcl.js
/core/modules/utils/base64-utf8/base64-utf8.module.js
/core/modules/utils/base64-utf8/base64-utf8.module.min.js
/core/modules/utils/diff-match-patch/diff_match_patch.js
/plugins/tiddlywiki/async/files/async.min.v1.5.0.js
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/anyword-hint.js
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/css-hint.js
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/html-hint.js
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/javascript-hint.js
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/show-hint.js
/plugins/tiddlywiki/codemirror-autocomplete/files/addon/hint/xml-hint.js
/plugins/tiddlywiki/codemirror-closebrackets/files/addon/edit/closebrackets.js
/plugins/tiddlywiki/codemirror-closebrackets/files/addon/edit/matchbrackets.js
/plugins/tiddlywiki/codemirror-closetag/files/addon/edit/closetag.js
/plugins/tiddlywiki/codemirror-closetag/files/addon/fold/xml-fold.js
/core/modules/utils/diff-match-patch/diff_match_patch_uncompressed.js
/core/modules/utils/dom/csscolorparser.js
/plugins/tiddlywiki/*/files/

View File

@@ -64,7 +64,23 @@ rules:
init-declarations: 'off'
jsx-quotes: error
key-spacing: 'off'
keyword-spacing: 'off'
keyword-spacing:
- error
- before: true
after: false
overrides:
'case':
after: true
'do':
'after': true
'else':
after: true
'return':
after: true
'throw':
after: true
'try':
after: true
line-comment-position: 'off'
linebreak-style: 'off'
lines-around-comment: 'off'

View File

@@ -5,7 +5,7 @@
# Default to the current version number for building the plugin library
if [ -z "$TW5_BUILD_VERSION" ]; then
TW5_BUILD_VERSION=v5.2.0
TW5_BUILD_VERSION=v5.2.2
fi
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"

View File

@@ -68,6 +68,26 @@ $tw.utils.isArrayEqual = function(array1,array2) {
});
};
/*
Add an entry to a sorted array if it doesn't already exist, while maintaining the sort order
*/
$tw.utils.insertSortedArray = function(array,value) {
var low = 0, high = array.length - 1, mid, cmp;
while(low <= high) {
mid = (low + high) >> 1;
cmp = value.localeCompare(array[mid]);
if(cmp > 0) {
low = mid + 1;
} else if(cmp < 0) {
high = mid - 1;
} else {
return array;
}
}
array.splice(low,0,value);
return array;
};
/*
Push entries onto an array, removing them first if they already exist in the array
array: array to modify (assumed to be free of duplicates)
@@ -256,6 +276,28 @@ $tw.utils.deepDefaults = function(object /*, sourceObjectList */) {
return object;
};
/*
Convert a URIComponent encoded string to a string safely
*/
$tw.utils.decodeURIComponentSafe = function(s) {
var v = s;
try {
v = decodeURIComponent(s);
} catch(e) {}
return v;
};
/*
Convert a URI encoded string to a string safely
*/
$tw.utils.decodeURISafe = function(s) {
var v = s;
try {
v = decodeURI(s);
} catch(e) {}
return v;
};
/*
Convert "&amp;" to &, "&nbsp;" to nbsp, "&lt;" to <, "&gt;" to > and "&quot;" to "
*/
@@ -387,6 +429,19 @@ $tw.utils.parseFields = function(text,fields) {
return fields;
};
// Safely parse a string as JSON
$tw.utils.parseJSONSafe = function(text,defaultJSON) {
try {
return JSON.parse(text);
} catch(e) {
if(typeof defaultJSON === "function") {
return defaultJSON(e);
} else {
return defaultJSON || {};
}
}
};
/*
Resolves a source filepath delimited with `/` relative to a specified absolute root filepath.
In relative paths, the special folder name `..` refers to immediate parent directory, and the
@@ -1059,7 +1114,7 @@ $tw.Wiki = function(options) {
tiddlerTitles = null, // Array of tiddler titles
getTiddlerTitles = function() {
if(!tiddlerTitles) {
tiddlerTitles = Object.keys(tiddlers);
tiddlerTitles = Object.keys(tiddlers).sort(function(a,b) {return a.localeCompare(b);});
}
return tiddlerTitles;
},
@@ -1112,10 +1167,8 @@ $tw.Wiki = function(options) {
}
// Save the new tiddler
tiddlers[title] = tiddler;
// Check we've got it's title
if(tiddlerTitles && tiddlerTitles.indexOf(title) === -1) {
tiddlerTitles.push(title);
}
// Check we've got the title
tiddlerTitles = $tw.utils.insertSortedArray(tiddlerTitles || [],title);
// Record the new tiddler state
updateDescriptor["new"] = {
tiddler: tiddler,
@@ -1212,8 +1265,12 @@ $tw.Wiki = function(options) {
index,titlesLength,title;
for(index = 0, titlesLength = titles.length; index < titlesLength; index++) {
title = titles[index];
var shadowInfo = shadowTiddlers[title];
callback(shadowInfo.tiddler,title);
if(tiddlers[title]) {
callback(tiddlers[title],title);
} else {
var shadowInfo = shadowTiddlers[title];
callback(shadowInfo.tiddler,title);
}
}
};
@@ -1296,7 +1353,7 @@ $tw.Wiki = function(options) {
var tiddler = tiddlers[title];
if(tiddler) {
if(tiddler.fields.type === "application/json" && tiddler.hasField("plugin-type") && tiddler.fields.text) {
pluginInfo[tiddler.fields.title] = JSON.parse(tiddler.fields.text);
pluginInfo[tiddler.fields.title] = $tw.utils.parseJSONSafe(tiddler.fields.text);
results.modifiedPlugins.push(tiddler.fields.title);
}
} else {
@@ -1429,7 +1486,7 @@ $tw.Wiki.prototype.defineTiddlerModules = function() {
}
break;
case "application/json":
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],JSON.parse(tiddler.fields.text));
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],$tw.utils.parseJSONSafe(tiddler.fields.text));
break;
case "application/x-tiddler-dictionary":
$tw.modules.define(tiddler.fields.title,tiddler.fields["module-type"],$tw.utils.parseFields(tiddler.fields.text));
@@ -1602,8 +1659,8 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/json","tiddlerdeserializer",{
}
for(var f in data) {
if($tw.utils.hop(data,f)) {
// Check field name doesn't contain whitespace or control characters
if(typeof(data[f]) !== "string" || /[\x00-\x1F\s]/.test(f)) {
// Check field name doesn't contain control characters
if(typeof(data[f]) !== "string" || /[\x00-\x1F]/.test(f)) {
return false;
}
}
@@ -1618,7 +1675,7 @@ $tw.modules.define("$:/boot/tiddlerdeserializer/json","tiddlerdeserializer",{
}
return true;
},
data = JSON.parse(text);
data = $tw.utils.parseJSONSafe(text);
if($tw.utils.isArray(data) && isTiddlerArrayValid(data)) {
return data;
} else if(isTiddlerValid(data)) {
@@ -1658,7 +1715,7 @@ $tw.boot.decryptEncryptedTiddlers = function(callback) {
$tw.crypto.setPassword(data.password);
var decryptedText = $tw.crypto.decrypt(encryptedText);
if(decryptedText) {
var json = JSON.parse(decryptedText);
var json = $tw.utils.parseJSONSafe(decryptedText);
for(var title in json) {
$tw.preloadTiddler(json[title]);
}
@@ -1858,7 +1915,7 @@ filepath: pathname of the directory containing the specification file
$tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
var tiddlers = [];
// Read the specification
var filesInfo = JSON.parse(fs.readFileSync(filepath + path.sep + "tiddlywiki.files","utf8"));
var filesInfo = $tw.utils.parseJSONSafe(fs.readFileSync(filepath + path.sep + "tiddlywiki.files","utf8"));
// Helper to process a file
var processFile = function(filename,isTiddlerFile,fields,isEditableFile) {
var extInfo = $tw.config.fileExtensionInfo[path.extname(filename)],
@@ -1885,13 +1942,13 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
value = path.basename(filename);
break;
case "filename-uri-decoded":
value = decodeURIComponent(path.basename(filename));
value = $tw.utils.decodeURIComponentSafe(path.basename(filename));
break;
case "basename":
value = path.basename(filename,path.extname(filename));
break;
case "basename-uri-decoded":
value = decodeURIComponent(path.basename(filename,path.extname(filename)));
value = $tw.utils.decodeURIComponentSafe(path.basename(filename,path.extname(filename)));
break;
case "extname":
value = path.extname(filename);
@@ -1919,6 +1976,20 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
tiddlers.push({tiddlers: fileTiddlers});
}
};
// Helper to recursively search subdirectories
var getAllFiles = function(dirPath, recurse, arrayOfFiles) {
recurse = recurse || false;
arrayOfFiles = arrayOfFiles || [];
var files = fs.readdirSync(dirPath);
files.forEach(function(file) {
if (recurse && fs.statSync(dirPath + path.sep + file).isDirectory()) {
arrayOfFiles = getAllFiles(dirPath + path.sep + file, recurse, arrayOfFiles);
} else if(fs.statSync(dirPath + path.sep + file).isFile()){
arrayOfFiles.push(path.join(dirPath, path.sep, file));
}
});
return arrayOfFiles;
}
// Process the listed tiddlers
$tw.utils.each(filesInfo.tiddlers,function(tidInfo) {
if(tidInfo.prefix && tidInfo.suffix) {
@@ -1942,13 +2013,14 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
// Process directory specifier
var dirPath = path.resolve(filepath,dirSpec.path);
if(fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory()) {
var files = fs.readdirSync(dirPath),
var files = getAllFiles(dirPath, dirSpec.searchSubdirectories),
fileRegExp = new RegExp(dirSpec.filesRegExp || "^.*$"),
metaRegExp = /^.*\.meta$/;
for(var t=0; t<files.length; t++) {
var filename = files[t];
var thisPath = path.relative(filepath, files[t]),
filename = path.basename(thisPath);
if(filename !== "tiddlywiki.files" && !metaRegExp.test(filename) && fileRegExp.test(filename)) {
processFile(dirPath + path.sep + filename,dirSpec.isTiddlerFile,dirSpec.fields,dirSpec.isEditableFile);
processFile(thisPath,dirSpec.isTiddlerFile,dirSpec.fields,dirSpec.isEditableFile);
}
}
} else {
@@ -1973,7 +2045,7 @@ $tw.loadPluginFolder = function(filepath,excludeRegExp) {
console.log("Warning: missing plugin.info file in " + filepath);
return null;
}
var pluginInfo = JSON.parse(fs.readFileSync(infoPath,"utf8"));
var pluginInfo = $tw.utils.parseJSONSafe(fs.readFileSync(infoPath,"utf8"));
// Read the plugin files
var pluginFiles = $tw.loadTiddlersFromPath(filepath,excludeRegExp);
// Save the plugin tiddlers into the plugin info
@@ -2090,7 +2162,7 @@ $tw.loadWikiTiddlers = function(wikiPath,options) {
pluginFields;
// Bail if we don't have a wiki info file
if(fs.existsSync(wikiInfoPath)) {
wikiInfo = JSON.parse(fs.readFileSync(wikiInfoPath,"utf8"));
wikiInfo = $tw.utils.parseJSONSafe(fs.readFileSync(wikiInfoPath,"utf8"));
} else {
return null;
}
@@ -2603,3 +2675,4 @@ if(typeof(exports) !== "undefined") {
} else {
_boot(window.$tw);
}
//# sourceURL=$:/boot/boot.js

View File

@@ -117,3 +117,4 @@ if(typeof(exports) === "undefined") {
// Export functionality as a module
exports.bootprefix = _bootprefix;
}
//# sourceURL=$:/boot/bootprefix.js

File diff suppressed because one or more lines are too long

View File

@@ -4,7 +4,7 @@ type: text/plain
TiddlyWiki created by Jeremy Ruston, (jeremy [at] jermolene [dot] com)
Copyright (c) 2004-2007, Jeremy Ruston
Copyright (c) 2007-2021, UnaMesa Association
Copyright (c) 2007-2022, UnaMesa Association
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -32,8 +32,6 @@ ExportTiddler/Caption: export tiddler
ExportTiddler/Hint: Export tiddler
ExportTiddlers/Caption: export tiddlers
ExportTiddlers/Hint: Export tiddlers
ExportTiddlyWikiCore/Caption: export TiddlyWiki core
ExportTiddlyWikiCore/Hint: Export the ~TiddlyWiki core code for running with external ~JavaScript
SidebarSearch/Hint: Select the sidebar search field
Fold/Caption: fold tiddler
Fold/Hint: Fold the body of this tiddler

View File

@@ -27,10 +27,15 @@ Basics/Tiddlers/Prompt: Number of tiddlers
Basics/Title/Prompt: Title of this ~TiddlyWiki
Basics/Username/Prompt: Username for signing edits
Basics/Version/Prompt: ~TiddlyWiki version
Cascades/Caption: Cascades
Cascades/Hint: These global rules are used to dynamically choose certain templates. The result of the cascade is the result of the first filter in the sequence that returns a result
Cascades/TagPrompt: Filters tagged <$macrocall $name="tag" tag=<<currentTiddler>>/>
EditorTypes/Caption: Editor Types
EditorTypes/Editor/Caption: Editor
EditorTypes/Hint: These tiddlers determine which editor is used to edit specific tiddler types.
EditorTypes/Type/Caption: Type
EditTemplateBody/Caption: Edit Template Body
EditTemplateBody/Hint: This rule cascade is used by the default edit template to dynamically choose the template for editing the body of a tiddler.
Info/Caption: Info
Info/Hint: Information about this TiddlyWiki
KeyboardShortcuts/Add/Prompt: Type shortcut here
@@ -191,6 +196,8 @@ Settings/TitleLinks/Yes/Description: Display tiddler titles as links
Settings/MissingLinks/Caption: Wiki Links
Settings/MissingLinks/Hint: Choose whether to link to tiddlers that do not exist yet
Settings/MissingLinks/Description: Enable links to missing tiddlers
StoryTiddler/Caption: Story Tiddler
StoryTiddler/Hint: This rule cascade is used to dynamically choose the template for displaying a tiddler in the story river.
StoryView/Caption: Story View
StoryView/Prompt: Current view:
Stylesheets/Caption: Stylesheets
@@ -201,6 +208,10 @@ Theme/Caption: Theme
Theme/Prompt: Current theme:
TiddlerFields/Caption: Tiddler Fields
TiddlerFields/Hint: This is the full set of TiddlerFields in use in this wiki (including system tiddlers but excluding shadow tiddlers).
TiddlerColour/Caption: Tiddler Colour
TiddlerColour/Hint: This rules cascade is used to dynamically choose the colour for a tiddler (used for the icon and the associated tag pill).
TiddlerIcon/Caption: Tiddler Icon
TiddlerIcon/Hint: This rules cascade is used to dynamically choose the icon for a tiddler.
Toolbars/Caption: Toolbars
Toolbars/EditToolbar/Caption: Edit Toolbar
Toolbars/EditToolbar/Hint: Choose which buttons are displayed for tiddlers in edit mode. Drag and drop to change the ordering
@@ -212,3 +223,7 @@ Toolbars/EditorToolbar/Hint: Choose which buttons are displayed in the editor to
Toolbars/ViewToolbar/Caption: View Toolbar
Toolbars/ViewToolbar/Hint: Choose which buttons are displayed for tiddlers in view mode. Drag and drop to change the ordering
Tools/Download/Full/Caption: Download full wiki
ViewTemplateBody/Caption: View Template Body
ViewTemplateBody/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the body of a tiddler.
ViewTemplateTitle/Caption: View Template Title
ViewTemplateTitle/Hint: This rule cascade is used by the default view template to dynamically choose the template for displaying the title of a tiddler.

View File

@@ -3,6 +3,7 @@ title: $:/language/Docs/Fields/
_canonical_uri: The full URI of an external image tiddler
bag: The name of the bag from which a tiddler came
caption: The text to be displayed on a tab or button
code-body: The view template will display the tiddler as code if set to ''yes''
color: The CSS color value associated with a tiddler
component: The name of the component responsible for an [[alert tiddler|AlertMechanism]]
current-tiddler: Used to cache the top tiddler in a [[history list|HistoryMechanism]]
@@ -13,9 +14,9 @@ description: The descriptive text for a plugin, or a modal dialogue
draft.of: For draft tiddlers, contains the title of the tiddler of which this is a draft
draft.title: For draft tiddlers, contains the proposed new title of the tiddler
footer: The footer text for a wizard
hide-body: The view template will hide bodies of tiddlers if set to: ''yes''
hide-body: The view template will hide bodies of tiddlers if set to ''yes''
icon: The title of the tiddler containing the icon associated with a tiddler
library: Indicates that a tiddler should be saved as a JavaScript library if set to: ''yes''
library: Indicates that a tiddler should be saved as a JavaScript library if set to ''yes''
list: An ordered list of tiddler titles associated with a tiddler
list-before: If set, the title of a tiddler before which this tiddler should be added to the ordered list of tiddler titles, or at the start of the list if this field is present but empty
list-after: If set, the title of the tiddler after which this tiddler should be added to the ordered list of tiddler titles, or at the end of the list if this field is present but empty
@@ -32,7 +33,7 @@ tags: A list of tags associated with a tiddler
text: The body text of a tiddler
throttle.refresh: If present, throttles refreshes of this tiddler
title: The unique name of a tiddler
toc-link: Suppresses the tiddler's link in a Table of Contents tree if set to: ''no''
toc-link: Suppresses the tiddler's link in a Table of Contents tree if set to ''no''
type: The content type of a tiddler
version: Version information for a plugin
_is_skinny: If present, indicates that the tiddler text field must be loaded from the server

View File

@@ -22,7 +22,6 @@ All parameters are optional with safe defaults, and can be specified in any orde
* ''readers'' - comma-separated list of principals allowed to read from this wiki
* ''writers'' - comma-separated list of principals allowed to write to this wiki
* ''csrf-disable'' - set to "yes" to disable CSRF checks (defaults to "no")
* ''sse-enabled'' - set to "yes" to enable Server-sent events (defaults to "no")
* ''root-tiddler'' - the tiddler to serve at the root (defaults to "$:/core/save/all")
* ''root-render-type'' - the content type to which the root tiddler should be rendered (defaults to "text/plain")
* ''root-serve-type'' - the content type with which the root tiddler should be served (defaults to "text/html")

View File

@@ -30,5 +30,5 @@ Upgrader/System/Warning: Core module tiddler.
Upgrader/System/Alert: You are about to import a tiddler that will overwrite a core module tiddler. This is not recommended as it may make the system unstable.
Upgrader/ThemeTweaks/Created: Migrated theme tweak from <$text text=<<from>>/>.
Upgrader/Tiddler/Disabled: Disabled tiddler.
Upgrader/Tiddler/Selected: User selected.
Upgrader/Tiddler/Selected: Selected tiddler.
Upgrader/Tiddler/Unselected: Unselected tiddler.

View File

@@ -14,7 +14,7 @@ ConfirmAction: Do you wish to proceed?
Count: count
DefaultNewTiddlerTitle: New Tiddler
Diffs/CountMessage: <<diff-count>> differences
DropMessage: Drop here (or use the 'Escape' key to cancel)
DropMessage: Drop now (or use the 'Escape' key to cancel)
Encryption/Cancel: Cancel
Encryption/ConfirmClearPassword: Do you wish to clear the password? This will remove the encryption applied when saving this wiki
Encryption/PromptSetPassword: Set a new password for this TiddlyWiki

View File

@@ -48,7 +48,7 @@ Command.prototype.execute = function() {
}
// Tweak the tiddlywiki.info to remove any included wikis
var packagePath = $tw.boot.wikiPath + "/tiddlywiki.info",
packageJson = JSON.parse(fs.readFileSync(packagePath));
packageJson = $tw.utils.parseJSONSafe(fs.readFileSync(packagePath));
delete packageJson.includeWikis;
fs.writeFileSync(packagePath,JSON.stringify(packageJson,null,$tw.config.preferences.jsonSpaces));
return null;

View File

@@ -8,58 +8,59 @@ Render individual tiddlers and save the results to the specified files
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var widget = require("$:/core/modules/widgets/widget.js");
exports.info = {
name: "render",
synchronous: true
};
var Command = function(params,commander,callback) {
this.params = params;
this.commander = commander;
this.callback = callback;
};
Command.prototype.execute = function() {
if(this.params.length < 1) {
return "Missing tiddler filter";
}
var self = this,
fs = require("fs"),
path = require("path"),
wiki = this.commander.wiki,
tiddlerFilter = this.params[0],
filenameFilter = this.params[1] || "[is[tiddler]addsuffix[.html]]",
type = this.params[2] || "text/html",
template = this.params[3],
variableList = this.params.slice(4),
tiddlers = wiki.filterTiddlers(tiddlerFilter),
variables = Object.create(null);
while(variableList.length >= 2) {
variables[variableList[0]] = variableList[1];
variableList = variableList.slice(2);
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var widget = require("$:/core/modules/widgets/widget.js");
exports.info = {
name: "render",
synchronous: true
};
var Command = function(params,commander,callback) {
this.params = params;
this.commander = commander;
this.callback = callback;
};
Command.prototype.execute = function() {
if(this.params.length < 1) {
return "Missing tiddler filter";
}
$tw.utils.each(tiddlers,function(title) {
var parser = wiki.parseTiddler(template || title);
var widgetNode = wiki.makeWidget(parser,{variables: $tw.utils.extend({},variables,{currentTiddler: title})}),
container = $tw.fakeDocument.createElement("div");
widgetNode.render(container,null);
var text = type === "text/html" ? container.innerHTML : container.textContent,
filepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);
if(self.commander.verbose) {
console.log("Rendering \"" + title + "\" to \"" + filepath + "\"");
}
$tw.utils.createFileDirectories(filepath);
fs.writeFileSync(filepath,text,"utf8");
});
return null;
};
exports.Command = Command;
})();
var self = this,
fs = require("fs"),
path = require("path"),
wiki = this.commander.wiki,
tiddlerFilter = this.params[0],
filenameFilter = this.params[1] || "[is[tiddler]addsuffix[.html]]",
type = this.params[2] || "text/html",
template = this.params[3],
variableList = this.params.slice(4),
tiddlers = wiki.filterTiddlers(tiddlerFilter),
variables = Object.create(null);
while(variableList.length >= 2) {
variables[variableList[0]] = variableList[1];
variableList = variableList.slice(2);
}
$tw.utils.each(tiddlers,function(title) {
var filepath = path.resolve(self.commander.outputPath,wiki.filterTiddlers(filenameFilter,$tw.rootWidget,wiki.makeTiddlerIterator([title]))[0]);
if(self.commander.verbose) {
console.log("Rendering \"" + title + "\" to \"" + filepath + "\"");
}
var parser = wiki.parseTiddler(template || title),
widgetNode = wiki.makeWidget(parser,{variables: $tw.utils.extend({},variables,{currentTiddler: title})}),
container = $tw.fakeDocument.createElement("div");
widgetNode.render(container,null);
var text = type === "text/html" ? container.innerHTML : container.textContent;
$tw.utils.createFileDirectories(filepath);
fs.writeFileSync(filepath,text,"utf8");
});
return null;
};
exports.Command = Command;
})();

View File

@@ -69,7 +69,7 @@ Command.prototype.execute = function() {
$tw.utils.createFileDirectories(pathname);
fs.writeFileSync(pathname,JSON.stringify(tiddler),"utf8");
// Collect the skinny list data
var pluginTiddlers = JSON.parse(tiddler.text),
var pluginTiddlers = $tw.utils.parseJSONSafe(tiddler.text),
readmeContent = (pluginTiddlers.tiddlers[title + "/readme"] || {}).text,
doesRequireReload = !!self.commander.wiki.doesPluginInfoRequireReload(pluginTiddlers),
iconTiddler = pluginTiddlers.tiddlers[title + "/icon"] || {},

View File

@@ -151,7 +151,7 @@ WikiFolderMaker.prototype.saveCustomPlugin = function(pluginTiddler) {
pluginInfo = pluginTiddler.getFieldStrings({exclude: ["text","type"]});
this.saveJSONFile(directory + path.sep + "plugin.info",pluginInfo);
self.log("Writing " + directory + path.sep + "plugin.info: " + JSON.stringify(pluginInfo,null,$tw.config.preferences.jsonSpaces));
var pluginTiddlers = JSON.parse(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin
var pluginTiddlers = $tw.utils.parseJSONSafe(pluginTiddler.fields.text).tiddlers; // A hashmap of tiddlers in the plugin
$tw.utils.each(pluginTiddlers,function(tiddler) {
self.saveTiddler(directory,new $tw.Tiddler(tiddler));
});

View File

@@ -17,16 +17,13 @@ exports["application/x-tiddler-html-div"] = function(text,fields) {
};
exports["application/json"] = function(text,fields) {
var incoming,
results = [];
try {
incoming = JSON.parse(text);
} catch(e) {
incoming = [{
title: "JSON error: " + e,
text: ""
}]
}
var results = [],
incoming = $tw.utils.parseJSONSafe(text,function(err) {
return [{
title: "JSON error: " + err,
text: ""
}];
});
if(!$tw.utils.isArray(incoming)) {
incoming = [incoming];
}

View File

@@ -135,7 +135,11 @@ FramedEngine.prototype.setText = function(text,type) {
Update the DomNode with the new text
*/
FramedEngine.prototype.updateDomNodeText = function(text) {
this.domNode.value = text;
try {
this.domNode.value = text;
} catch(e) {
// Ignore
}
};
/*
@@ -201,7 +205,7 @@ FramedEngine.prototype.handleInputEvent = function(event) {
this.widget.saveChanges(this.getText());
this.fixHeight();
if(this.widget.editInputActions) {
this.widget.invokeActionString(this.widget.editInputActions);
this.widget.invokeActionString(this.widget.editInputActions,this,event,{actionValue: this.getText()});
}
return true;
};

View File

@@ -85,7 +85,11 @@ SimpleEngine.prototype.setText = function(text,type) {
Update the DomNode with the new text
*/
SimpleEngine.prototype.updateDomNodeText = function(text) {
this.domNode.value = text;
try {
this.domNode.value = text;
} catch(e) {
// Ignore
}
};
/*
@@ -129,7 +133,7 @@ SimpleEngine.prototype.handleInputEvent = function(event) {
this.widget.saveChanges(this.getText());
this.fixHeight();
if(this.widget.editInputActions) {
this.widget.invokeActionString(this.widget.editInputActions);
this.widget.invokeActionString(this.widget.editInputActions,this,event,{actionValue: this.getText()});
}
return true;
};

View File

@@ -324,7 +324,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
If there are no Files, let the browser handle it.
*/
EditTextWidget.prototype.handleDropEvent = function(event) {
if(event.dataTransfer.files.length) {
if($tw.utils.dragEventContainsFiles(event)) {
event.preventDefault();
event.stopPropagation();
this.dispatchDOMEvent(this.cloneEvent(event,["dataTransfer"]));
@@ -332,7 +332,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
};
EditTextWidget.prototype.handlePasteEvent = function(event) {
if(event.clipboardData.files.length) {
if(event.clipboardData && event.clipboardData.files && event.clipboardData.files.length) {
event.preventDefault();
event.stopPropagation();
this.dispatchDOMEvent(this.cloneEvent(event,["clipboardData"]));

View File

@@ -0,0 +1,17 @@
/*\
title: $:/core/modules/editor/operations/text/focus-editor.js
type: application/javascript
module-type: texteditoroperation
Simply focus the Text editor
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports["focus-editor"] = function(event,operation) {
operation = null;
};
})();

View File

@@ -13,15 +13,17 @@ Text editor operation to wrap the selected lines with a prefix and suffix
"use strict";
exports["wrap-lines"] = function(event,operation) {
var prefix = event.paramObject.prefix || "",
suffix = event.paramObject.suffix || "";
// Cut just past the preceding line break, or the start of the text
operation.cutStart = $tw.utils.findPrecedingLineBreak(operation.text,operation.selStart);
// Cut to just past the following line break, or to the end of the text
operation.cutEnd = $tw.utils.findFollowingLineBreak(operation.text,operation.selEnd);
// Add the prefix and suffix
operation.replacement = event.paramObject.prefix + "\n" +
operation.replacement = prefix + "\n" +
operation.text.substring(operation.cutStart,operation.cutEnd) + "\n" +
event.paramObject.suffix + "\n";
operation.newSelStart = operation.cutStart + event.paramObject.prefix.length + 1;
suffix + "\n";
operation.newSelStart = operation.cutStart + prefix.length + 1;
operation.newSelEnd = operation.newSelStart + (operation.cutEnd - operation.cutStart);
};

View File

@@ -0,0 +1,53 @@
/*\
title: $:/core/modules/filterrunprefixes/cascade.js
type: application/javascript
module-type: filterrunprefix
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter prefix function
*/
exports.cascade = function(operationSubFunction,options) {
return function(results,source,widget) {
if(results.length !== 0) {
var filterList = operationSubFunction(source,widget),
filterFnList = [];
var inputResults = results.toArray();
results.clear();
$tw.utils.each(inputResults,function(title) {
var result = ""; // If no filter matches, we return an empty string
$tw.utils.each(filterList,function(filter,index) {
if(!filterFnList[index]) {
filterFnList[index] = options.wiki.compileFilter(filter);
}
var output = filterFnList[index](options.wiki.makeTiddlerIterator([title]),{
getVariable: function(name,opts) {
opts = opts || {};
opts.variables = {
"currentTiddler": "" + title,
"..currentTiddler": widget.getVariable("currentTiddler")
};
if(name in opts.variables) {
return opts.variables[name];
} else {
return widget.getVariable(name,opts);
}
}
});
if(output.length !== 0) {
result = output[0];
return false;
}
});
results.push(result);
});
}
}
};
})();

View File

@@ -16,23 +16,30 @@ Export our filter function
exports.filter = function(operationSubFunction,options) {
return function(results,source,widget) {
if(results.length > 0) {
var resultsToRemove = [];
var resultsToRemove = [],
index = 0;
results.each(function(title) {
var filtered = operationSubFunction(options.wiki.makeTiddlerIterator([title]),{
getVariable: function(name) {
switch(name) {
case "currentTiddler":
return "" + title;
case "..currentTiddler":
return widget.getVariable("currentTiddler");
default:
return widget.getVariable(name);
getVariable: function(name,opts) {
opts = opts || {};
opts.variables = {
"currentTiddler": "" + title,
"..currentTiddler": widget.getVariable("currentTiddler"),
"index": "" + index,
"revIndex": "" + (results.length - 1 - index),
"length": "" + results.length
};
if(name in opts.variables) {
return opts.variables[name];
} else {
return widget.getVariable(name,opts);
}
}
});
if(filtered.length === 0) {
resultsToRemove.push(title);
}
++index;
});
results.remove(resultsToRemove);
}

View File

@@ -15,22 +15,29 @@ Export our filter prefix function
exports.map = function(operationSubFunction,options) {
return function(results,source,widget) {
if(results.length > 0) {
var inputTitles = results.toArray();
var inputTitles = results.toArray(),
index = 0;
results.clear();
$tw.utils.each(inputTitles,function(title) {
var filtered = operationSubFunction(options.wiki.makeTiddlerIterator([title]),{
getVariable: function(name) {
switch(name) {
case "currentTiddler":
return "" + title;
case "..currentTiddler":
return widget.getVariable("currentTiddler");
default:
return widget.getVariable(name);
getVariable: function(name,opts) {
opts = opts || {};
opts.variables = {
"currentTiddler": "" + title,
"..currentTiddler": widget.getVariable("currentTiddler"),
"index": "" + index,
"revIndex": "" + (inputTitles.length - 1 - index),
"length": "" + inputTitles.length
};
if(name in opts.variables) {
return opts.variables[name];
} else {
return widget.getVariable(name,opts);
}
}
});
results.push(filtered[0] || "");
++index;
});
}
}

View File

@@ -15,26 +15,24 @@ Export our filter prefix function
exports.reduce = function(operationSubFunction,options) {
return function(results,source,widget) {
if(results.length > 0) {
var accumulator = "";
var index = 0;
var accumulator = "",
index = 0;
results.each(function(title) {
var list = operationSubFunction(options.wiki.makeTiddlerIterator([title]),{
getVariable: function(name) {
switch(name) {
case "currentTiddler":
return "" + title;
case "..currentTiddler":
return widget.getVariable("currentTiddler");
case "accumulator":
return "" + accumulator;
case "index":
return "" + index;
case "revIndex":
return "" + (results.length - 1 - index);
case "length":
return "" + results.length;
default:
return widget.getVariable(name);
getVariable: function(name,opts) {
opts = opts || {};
opts.variables = {
"currentTiddler": "" + title,
"..currentTiddler": widget.getVariable("currentTiddler"),
"index": "" + index,
"revIndex": "" + (results.length - 1 - index),
"length": "" + results.length,
"accumulator": "" + accumulator
};
if(name in opts.variables) {
return opts.variables[name];
} else {
return widget.getVariable(name,opts);
}
}
});

View File

@@ -26,14 +26,16 @@ exports.sort = function(operationSubFunction,options) {
compareFn;
results.each(function(title) {
var key = operationSubFunction(options.wiki.makeTiddlerIterator([title]),{
getVariable: function(name) {
switch(name) {
case "currentTiddler":
return "" + title;
case "..currentTiddler":
return widget.getVariable("currentTiddler");
default:
return widget.getVariable(name);
getVariable: function(name,opts) {
opts = opts || {};
opts.variables = {
"currentTiddler": "" + title,
"..currentTiddler": widget.getVariable("currentTiddler")
};
if(name in opts.variables) {
return opts.variables[name];
} else {
return widget.getVariable(name,opts);
}
}
});

View File

@@ -95,10 +95,12 @@ function parseFilterOperation(operators,filterString,p) {
if(nextBracketPos === -1) {
throw "Missing closing bracket in filter expression";
}
if(!operator.regexp) {
if(operator.regexp) {
operand.text = "";
} else {
operand.text = filterString.substring(p,nextBracketPos);
operator.operands.push(operand);
}
operator.operands.push(operand);
p = nextBracketPos + 1;
}

View File

@@ -52,7 +52,7 @@ exports.all = function(source,operator,options) {
results.pushTop(subop(source,operator.prefix,options));
}
}
return results.toArray();
return results.makeTiddlerIterator(options.wiki);
};
})();

View File

@@ -16,11 +16,11 @@ Filter operator for returning all the backlinks from a tiddler
Export our filter function
*/
exports.backlinks = function(source,operator,options) {
var results = [];
var results = new $tw.utils.LinkedList();
source(function(tiddler,title) {
$tw.utils.pushTop(results,options.wiki.getTiddlerBacklinks(title));
results.pushTop(options.wiki.getTiddlerBacklinks(title));
});
return results;
return results.makeTiddlerIterator(options.wiki);
};
})();

View File

@@ -0,0 +1,27 @@
/*\
title: $:/core/modules/filters/crypto.js
type: application/javascript
module-type: filteroperator
Filter operators for cryptography, using the Stanford JavaScript library
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.sha256 = function(source,operator,options) {
var results = [],
length = parseInt(operator.operand,10) || 20,
sha256 = function(text) {
return sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(text)).substr(0,length);
};
source(function(tiddler,title) {
results.push(sha256(title));
});
return results;
};
})();

View File

@@ -19,12 +19,7 @@ Export our filter functions
exports.decodeuricomponent = function(source,operator,options) {
var results = [];
source(function(tiddler,title) {
var value = title;
try {
value = decodeURIComponent(title);
} catch(e) {
}
results.push(value);
results.push($tw.utils.decodeURIComponentSafe(title));
});
return results;
};
@@ -40,12 +35,7 @@ exports.encodeuricomponent = function(source,operator,options) {
exports.decodeuri = function(source,operator,options) {
var results = [];
source(function(tiddler,title) {
var value = title;
try {
value = decodeURI(title);
} catch(e) {
}
results.push(value);
results.push($tw.utils.decodeURISafe(title));
});
return results;
};

View File

@@ -20,7 +20,7 @@ exports.insertbefore = function(source,operator,options) {
source(function(tiddler,title) {
results.push(title);
});
var target = options.widget && options.widget.getVariable(operator.suffix || "currentTiddler");
var target = operator.operands[1] || (options.widget && options.widget.getVariable(operator.suffix || "currentTiddler"));
if(target !== operator.operand) {
// Remove the entry from the list if it is present
var pos = results.indexOf(operator.operand);

View File

@@ -19,13 +19,13 @@ exports.draft = function(source,prefix,options) {
var results = [];
if(prefix === "!") {
source(function(tiddler,title) {
if(!tiddler || !$tw.utils.hop(tiddler.fields,"draft.of")) {
if(!tiddler || !tiddler.isDraft()) {
results.push(title);
}
});
} else {
source(function(tiddler,title) {
if(tiddler && $tw.utils.hop(tiddler.fields,"draft.of") && (tiddler.fields["draft.of"].length !== 0)) {
if(tiddler && tiddler.isDraft()) {
results.push(title);
}
});

View File

@@ -20,7 +20,7 @@ exports.links = function(source,operator,options) {
source(function(tiddler,title) {
results.pushTop(options.wiki.getTiddlerLinks(title));
});
return results.toArray();
return results.makeTiddlerIterator(options.wiki);
};
})();

View File

@@ -87,7 +87,8 @@ exports.butlast = function(source,operator,options) {
source(function(tiddler,title) {
results.push(title);
});
return results.slice(0,-count);
var index = count === 0 ? results.length : -count;
return results.slice(0,index);
};
exports.bl = exports.butlast;
@@ -103,4 +104,16 @@ exports.nth = function(source,operator,options) {
return results.slice(count - 1,count);
};
/*
The zero based nth member of the list
*/
exports.zth = function(source,operator,options) {
var count = $tw.utils.getInt(operator.operand,0),
results = [];
source(function(tiddler,title) {
results.push(title);
});
return results.slice(count,count + 1);
};
})();

View File

@@ -5,9 +5,11 @@ module-type: filteroperator
Filter operator that looks up values via a title prefix
[lookup:<field>[<prefix>]]
[lookup:<defaultvalue>:<field OR index>[<prefix>],[<field-name OR index-name>]]
Prepends the prefix to the selected items and returns the specified field value
Prepends the prefix to the selected items and returns the specified
field or index value. If the 2nd suffix does not exist, it defaults to field.
If the second operand is missing it defaults to "text" for fields, and "0" for indexes
\*/
(function(){
@@ -20,10 +22,31 @@ Prepends the prefix to the selected items and returns the specified field value
Export our filter function
*/
exports.lookup = function(source,operator,options) {
var results = [];
source(function(tiddler,title) {
results.push(options.wiki.getTiddlerText(operator.operand + title) || operator.suffix || '');
});
var results = [],
suffixes = operator.suffixes || [],
defaultSuffix = suffixes[0] ? (suffixes[0][0] || "") : "",
indexSuffix = (suffixes[1] && suffixes[1][0] === "index") ? true : false,
target;
if(operator.operands.length == 2) {
target = operator.operands[1]
} else {
target = indexSuffix ? "0": "text";
}
if(indexSuffix) {
source(function(tiddler,title) {
var data = options.wiki.extractTiddlerDataItem(operator.operands[0]+title,target,defaultSuffix);
results.push(data);
});
} else {
source(function(tiddler,title) {
var value = defaultSuffix;
var targetTiddler = options.wiki.getTiddler(operator.operands[0]+title);
if(targetTiddler && targetTiddler.getFieldString(target)) {
value = targetTiddler.getFieldString(target);
}
results.push(value);
});
}
return results;
};

View File

@@ -165,6 +165,35 @@ exports["standard-deviation"] = makeNumericReducingOperator(
}
);
//trigonometry
exports.cos = makeNumericBinaryOperator(
function(a) {return Math.cos(a)}
);
exports.sin = makeNumericBinaryOperator(
function(a) {return Math.sin(a)}
);
exports.tan = makeNumericBinaryOperator(
function(a) {return Math.tan(a)}
);
exports.acos = makeNumericBinaryOperator(
function(a) {return Math.acos(a)}
);
exports.asin = makeNumericBinaryOperator(
function(a) {return Math.asin(a)}
);
exports.atan = makeNumericBinaryOperator(
function(a) {return Math.atan(a)}
);
exports.atan2 = makeNumericBinaryOperator(
function(a,b) {return Math.atan2(a,b)}
);
//Calculate the variance of a population of numbers in an array given its mean
function getVarianceFromArray(values,mean) {
var deviationTotal = values.reduce(function(accumulator,value) {

View File

@@ -0,0 +1,30 @@
/*\
title: $:/core/modules/filters/moduleproperty.js
type: application/javascript
module-type: filteroperator
Filter [[module-name]moduleproperty[name]] retrieve a module property
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter function
*/
exports.moduleproperty = function(source,operator,options) {
var results = [];
source(function(tiddler,title) {
var value = require(title)[operator.operand || ""];
if(value !== undefined) {
results.push(value);
}
});
results.sort();
return results;
};
})();

View File

@@ -17,11 +17,23 @@ Export our filter function
*/
exports.modules = function(source,operator,options) {
var results = [];
source(function(tiddler,title) {
$tw.utils.each($tw.modules.types[title],function(moduleInfo,moduleName) {
results.push(moduleName);
if(operator.operands.length >= 2) {
// Return the modules that have the module property specified in the first operand with the value in the second operand
source(function(tiddler,title) {
$tw.utils.each($tw.modules.types[title],function(moduleInfo,moduleName) {
if(require(moduleName)[operator.operands[0]] === operator.operands[1]) {
results.push(moduleName);
}
});
});
});
} else {
// Return all the module names without filtering
source(function(tiddler,title) {
$tw.utils.each($tw.modules.types[title],function(moduleInfo,moduleName) {
results.push(moduleName);
});
});
}
results.sort();
return results;
};

View File

@@ -16,19 +16,37 @@ Filter operator for checking if a title starts with a prefix
Export our filter function
*/
exports.prefix = function(source,operator,options) {
var results = [];
if(operator.prefix === "!") {
source(function(tiddler,title) {
if(title.substr(0,operator.operand.length) !== operator.operand) {
results.push(title);
}
});
var results = [],
suffixes = (operator.suffixes || [])[0] || [];
if(suffixes.indexOf("caseinsensitive") !== -1) {
var operand = operator.operand.toLowerCase();
if(operator.prefix === "!") {
source(function(tiddler,title) {
if(title.toLowerCase().substr(0,operand.length) !== operand) {
results.push(title);
}
});
} else {
source(function(tiddler,title) {
if(title.toLowerCase().substr(0,operand.length) === operand) {
results.push(title);
}
});
}
} else {
source(function(tiddler,title) {
if(title.substr(0,operator.operand.length) === operator.operand) {
results.push(title);
}
});
if(operator.prefix === "!") {
source(function(tiddler,title) {
if(title.substr(0,operator.operand.length) !== operator.operand) {
results.push(title);
}
});
} else {
source(function(tiddler,title) {
if(title.substr(0,operator.operand.length) === operator.operand) {
results.push(title);
}
});
}
}
return results;
};

View File

@@ -17,9 +17,13 @@ Export our filter function
*/
exports.range = function(source,operator,options) {
var results = [];
// Split the operand into numbers delimited by these symbols
var parts = operator.operand.split(/[,:;]/g),
beg, end, inc, i, fixed = 0;
// For backwards compatibility, if there is only one operand, try to split it using one of the delimiters
var parts = operator.operands || [];
if(parts.length === 1) {
parts = operator.operand.split(/[,:;]/g);
}
// Process the parts
var beg, end, inc, i, fixed = 0;
for (i=0; i<parts.length; i++) {
// Validate real number
if(!/^\s*[+-]?((\d+(\.\d*)?)|(\.\d+))\s*$/.test(parts[i])) {

View File

@@ -16,12 +16,22 @@ Filter operator for removing a prefix from each title in the list. Titles that d
Export our filter function
*/
exports.removeprefix = function(source,operator,options) {
var results = [];
source(function(tiddler,title) {
if(title.substr(0,operator.operand.length) === operator.operand) {
results.push(title.substr(operator.operand.length));
}
});
var results = [],
suffixes = (operator.suffixes || [])[0] || [];
if(suffixes.indexOf("caseinsensitive") !== -1) {
var operand = operator.operand.toLowerCase();
source(function(tiddler,title) {
if(title.toLowerCase().substr(0,operand.length) === operand) {
results.push(title.substr(operand.length));
}
});
} else {
source(function(tiddler,title) {
if(title.substr(0,operator.operand.length) === operator.operand) {
results.push(title.substr(operator.operand.length));
}
});
}
return results;
};

View File

@@ -16,12 +16,26 @@ Filter operator for removing a suffix from each title in the list. Titles that d
Export our filter function
*/
exports.removesuffix = function(source,operator,options) {
var results = [];
source(function(tiddler,title) {
if(title && title.substr(-operator.operand.length) === operator.operand) {
results.push(title.substr(0,title.length - operator.operand.length));
}
});
var results = [],
suffixes = (operator.suffixes || [])[0] || [];
if (!operator.operand) {
source(function(tiddler,title) {
results.push(title);
});
} else if(suffixes.indexOf("caseinsensitive") !== -1) {
var operand = operator.operand.toLowerCase();
source(function(tiddler,title) {
if(title && title.toLowerCase().substr(-operand.length) === operand) {
results.push(title.substr(0,title.length - operand.length));
}
});
} else {
source(function(tiddler,title) {
if(title && title.substr(-operator.operand.length) === operator.operand) {
results.push(title.substr(0,title.length - operator.operand.length));
}
});
}
return results;
};

View File

@@ -40,6 +40,7 @@ exports.search = function(source,operator,options) {
invert: invert,
field: fields,
excludeField: excludeFields,
some: hasFlag("some"),
caseSensitive: hasFlag("casesensitive"),
literal: hasFlag("literal"),
whitespace: hasFlag("whitespace"),

View File

@@ -119,23 +119,25 @@ exports["search-replace"] = function(source,operator,options) {
var results = [],
suffixes = operator.suffixes || [],
flagSuffix = (suffixes[0] ? (suffixes[0][0] || "") : ""),
flags = (flagSuffix.indexOf("g") !== -1 ? "g" : "") + (flagSuffix.indexOf("i") !== -1 ? "i" : ""),
flags = (flagSuffix.indexOf("g") !== -1 ? "g" : "") + (flagSuffix.indexOf("i") !== -1 ? "i" : "") + (flagSuffix.indexOf("m") !== -1 ? "m" : ""),
isRegExp = (suffixes[1] && suffixes[1][0] === "regexp") ? true : false,
searchTerm,
//Escape regexp characters if the operand is not a regular expression
searchTerm = isRegExp ? operator.operand : $tw.utils.escapeRegExp(operator.operand),
//Escape $ character in replacement string if not in regular expression mode
replacement = isRegExp ? operator.operands[1] : (operator.operands[1]||"").replace(/\$/g,"$$$$"),
regExp;
try {
regExp = new RegExp(searchTerm,flags);
} catch(ex) {
return ["RegExp error: " + ex];
}
source(function(tiddler,title) {
if(title && (operator.operands.length > 1)) {
//Escape regexp characters if the operand is not a regular expression
searchTerm = isRegExp ? operator.operand : $tw.utils.escapeRegExp(operator.operand);
try {
regExp = new RegExp(searchTerm,flags);
} catch(ex) {
return ["RegExp error: " + ex];
}
results.push(
title.replace(regExp,operator.operands[1])
title.replace(regExp,replacement)
);
regExp.lastIndex = 0;
} else {
results.push(title);
}

View File

@@ -16,19 +16,41 @@ Filter operator for checking if a title ends with a suffix
Export our filter function
*/
exports.suffix = function(source,operator,options) {
var results = [];
if(operator.prefix === "!") {
var results = [],
suffixes = (operator.suffixes || [])[0] || [];
if (!operator.operand) {
source(function(tiddler,title) {
if(title.substr(-operator.operand.length) !== operator.operand) {
results.push(title);
}
results.push(title);
});
} else if(suffixes.indexOf("caseinsensitive") !== -1) {
var operand = operator.operand.toLowerCase();
if(operator.prefix === "!") {
source(function(tiddler,title) {
if(title.toLowerCase().substr(-operand.length) !== operand) {
results.push(title);
}
});
} else {
source(function(tiddler,title) {
if(title.toLowerCase().substr(-operand.length) === operand) {
results.push(title);
}
});
}
} else {
source(function(tiddler,title) {
if(title.substr(-operator.operand.length) === operator.operand) {
results.push(title);
}
});
if(operator.prefix === "!") {
source(function(tiddler,title) {
if(title.substr(-operator.operand.length) !== operator.operand) {
results.push(title);
}
});
} else {
source(function(tiddler,title) {
if(title.substr(-operator.operand.length) === operator.operand) {
results.push(title);
}
});
}
}
return results;
};

View File

@@ -16,20 +16,13 @@ Filter operator returning all the selected tiddlers that are untagged
Export our filter function
*/
exports.untagged = function(source,operator,options) {
var results = [];
if(operator.prefix === "!") {
source(function(tiddler,title) {
if(tiddler && $tw.utils.isArray(tiddler.fields.tags) && tiddler.fields.tags.length > 0) {
$tw.utils.pushTop(results,title);
}
});
} else {
source(function(tiddler,title) {
if(!tiddler || !tiddler.hasField("tags") || ($tw.utils.isArray(tiddler.fields.tags) && tiddler.fields.tags.length === 0)) {
$tw.utils.pushTop(results,title);
}
});
}
var results = [],
expected = (operator.prefix === "!");
source(function(tiddler,title) {
if(((tiddler && $tw.utils.isArray(tiddler.fields.tags) && tiddler.fields.tags.length > 0) === expected) || (!tiddler && !expected)) {
results.push(title);
}
});
return results;
};

View File

@@ -239,7 +239,7 @@ exports.parseFilterVariable = function(source) {
};
/*
Look for an HTML attribute definition. Returns null if not found, otherwise returns {type: "attribute", name:, valueType: "string|indirect|macro", value:, start:, end:,}
Look for an HTML attribute definition. Returns null if not found, otherwise returns {type: "attribute", name:, type: "filtered|string|indirect|macro", value|filter|textReference:, start:, end:,}
*/
exports.parseAttribute = function(source,pos) {
var node = {
@@ -248,7 +248,7 @@ exports.parseAttribute = function(source,pos) {
// Define our regexps
var reAttributeName = /([^\/\s>"'=]+)/g,
reUnquotedAttribute = /([^\/\s<>"'=]+)/g,
reFilteredValue = /\{\{\{(.+?)\}\}\}/g,
reFilteredValue = /\{\{\{([\S\s]+?)\}\}\}/g,
reIndirectValue = /\{\{([^\}]+)\}\}/g;
// Skip whitespace
pos = $tw.utils.skipWhiteSpace(source,pos);

View File

@@ -66,7 +66,7 @@ exports.parse = function() {
};
/*
Look for an HTML tag. Returns null if not found, otherwise returns {type: "element", name:, attributes: [], isSelfClosing:, start:, end:,}
Look for an HTML tag. Returns null if not found, otherwise returns {type: "element", name:, attributes: {}, orderedAttributes: [], isSelfClosing:, start:, end:,}
*/
exports.parseTag = function(source,pos,options) {
options = options || {};
@@ -74,7 +74,8 @@ exports.parseTag = function(source,pos,options) {
node = {
type: "element",
start: pos,
attributes: {}
attributes: {},
orderedAttributes: []
};
// Define our regexps
var reTagName = /([a-zA-Z0-9\-\$]+)/g;
@@ -106,6 +107,7 @@ exports.parseTag = function(source,pos,options) {
// Process attributes
var attribute = $tw.utils.parseAttribute(source,pos);
while(attribute) {
node.orderedAttributes.push(attribute);
node.attributes[attribute.name] = attribute;
pos = attribute.end;
// Get the next attribute

View File

@@ -231,7 +231,10 @@ WikiParser.prototype.parseBlock = function(terminatorRegExpString) {
return nextMatch.rule.parse();
}
// Treat it as a paragraph if we didn't find a block rule
return [{type: "element", tag: "p", children: this.parseInlineRun(terminatorRegExp)}];
var start = this.pos;
var children = this.parseInlineRun(terminatorRegExp);
var end = this.pos;
return [{type: "element", tag: "p", children: children, start: start, end: end }];
};
/*
@@ -307,7 +310,7 @@ WikiParser.prototype.parseInlineRunUnterminated = function(options) {
while(this.pos < this.sourceLength && nextMatch) {
// Process the text preceding the run rule
if(nextMatch.matchIndex > this.pos) {
this.pushTextWidget(tree,this.source.substring(this.pos,nextMatch.matchIndex));
this.pushTextWidget(tree,this.source.substring(this.pos,nextMatch.matchIndex),this.pos,nextMatch.matchIndex);
this.pos = nextMatch.matchIndex;
}
// Process the run rule
@@ -317,7 +320,7 @@ WikiParser.prototype.parseInlineRunUnterminated = function(options) {
}
// Process the remaining text
if(this.pos < this.sourceLength) {
this.pushTextWidget(tree,this.source.substr(this.pos));
this.pushTextWidget(tree,this.source.substr(this.pos),this.pos,this.sourceLength);
}
this.pos = this.sourceLength;
return tree;
@@ -337,7 +340,7 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
if(terminatorMatch) {
if(!inlineRuleMatch || inlineRuleMatch.matchIndex >= terminatorMatch.index) {
if(terminatorMatch.index > this.pos) {
this.pushTextWidget(tree,this.source.substring(this.pos,terminatorMatch.index));
this.pushTextWidget(tree,this.source.substring(this.pos,terminatorMatch.index),this.pos,terminatorMatch.index);
}
this.pos = terminatorMatch.index;
if(options.eatTerminator) {
@@ -350,7 +353,7 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
if(inlineRuleMatch) {
// Preceding text
if(inlineRuleMatch.matchIndex > this.pos) {
this.pushTextWidget(tree,this.source.substring(this.pos,inlineRuleMatch.matchIndex));
this.pushTextWidget(tree,this.source.substring(this.pos,inlineRuleMatch.matchIndex),this.pos,inlineRuleMatch.matchIndex);
this.pos = inlineRuleMatch.matchIndex;
}
// Process the inline rule
@@ -364,7 +367,7 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
}
// Process the remaining text
if(this.pos < this.sourceLength) {
this.pushTextWidget(tree,this.source.substr(this.pos));
this.pushTextWidget(tree,this.source.substr(this.pos),this.pos,this.sourceLength);
}
this.pos = this.sourceLength;
return tree;
@@ -373,12 +376,12 @@ WikiParser.prototype.parseInlineRunTerminated = function(terminatorRegExp,option
/*
Push a text widget onto an array, respecting the configTrimWhiteSpace setting
*/
WikiParser.prototype.pushTextWidget = function(array,text) {
WikiParser.prototype.pushTextWidget = function(array,text,start,end) {
if(this.configTrimWhiteSpace) {
text = $tw.utils.trim(text);
}
if(text) {
array.push({type: "text", text: text});
array.push({type: "text", text: text, start: start, end: end});
}
};

View File

@@ -52,7 +52,7 @@ PluginSwitcher.prototype.switchPlugins = function() {
var tiddler = self.wiki.getTiddler(title);
if(tiddler && tiddler.isPlugin() && plugins.indexOf(title) === -1) {
plugins.push(title);
var pluginInfo = JSON.parse(self.wiki.getTiddlerText(title)),
var pluginInfo = $tw.utils.parseJSONSafe(self.wiki.getTiddlerText(title)),
dependents = $tw.utils.parseStringArray(tiddler.fields.dependents || "");
$tw.utils.each(dependents,function(title) {
accumulatePlugin(title);

View File

@@ -42,7 +42,7 @@ AndTidWiki.prototype.save = function(text,method,callback,options) {
window.twi.saveWiki(text);
} else {
// Get the pathname of this document
var pathname = decodeURIComponent(document.location.toString().split("#")[0]);
var pathname = $tw.utils.decodeURIComponentSafe(document.location.toString().split("#")[0]);
// Strip the file://
if(pathname.indexOf("file://") === 0) {
pathname = pathname.substr(7);

View File

@@ -26,7 +26,7 @@ DownloadSaver.prototype.save = function(text,method,callback,options) {
var p = document.location.pathname.lastIndexOf("/");
if(p !== -1) {
// We decode the pathname because document.location is URL encoded by the browser
filename = decodeURIComponent(document.location.pathname.substr(p+1));
filename = $tw.utils.decodeURIComponentSafe(document.location.pathname.substr(p+1));
}
}
if(!filename) {

View File

@@ -61,7 +61,7 @@ GiteaSaver.prototype.save = function(text,method,callback) {
}
var use_put = true;
if(xhr.status !== 404) {
getResponseData = JSON.parse(getResponseDataJson);
getResponseData = $tw.utils.parseJSONSafe(getResponseDataJson);
$tw.utils.each(getResponseData,function(details) {
if(details.name === filename) {
sha = details.sha;
@@ -72,7 +72,7 @@ GiteaSaver.prototype.save = function(text,method,callback) {
}
}
var data = {
message: $tw.language.getRawString("ControlPanel/Saving/GitService/CommitMessage"),
message: $tw.language.getString("ControlPanel/Saving/GitService/CommitMessage"),
content: $tw.utils.base64Encode(text),
sha: sha
};
@@ -104,7 +104,7 @@ GiteaSaver.prototype.upload = function(uri,method,headers,data,callback) {
if(err) {
return callback(err);
}
var putResponseData = JSON.parse(putResponseDataJson);
var putResponseData = $tw.utils.parseJSONSafe(putResponseDataJson);
callback(null);
}
});

View File

@@ -61,7 +61,7 @@ GitHubSaver.prototype.save = function(text,method,callback) {
return callback(err);
}
if(xhr.status !== 404) {
getResponseData = JSON.parse(getResponseDataJson);
getResponseData = $tw.utils.parseJSONSafe(getResponseDataJson);
$tw.utils.each(getResponseData,function(details) {
if(details.name === filename) {
sha = details.sha;
@@ -69,7 +69,7 @@ GitHubSaver.prototype.save = function(text,method,callback) {
});
}
var data = {
message: $tw.language.getRawString("ControlPanel/Saving/GitService/CommitMessage"),
message: $tw.language.getString("ControlPanel/Saving/GitService/CommitMessage"),
content: $tw.utils.base64Encode(text),
branch: branch,
sha: sha
@@ -84,7 +84,7 @@ GitHubSaver.prototype.save = function(text,method,callback) {
if(err) {
return callback(err);
}
var putResponseData = JSON.parse(putResponseDataJson);
var putResponseData = $tw.utils.parseJSONSafe(putResponseDataJson);
callback(null);
}
});

View File

@@ -58,7 +58,7 @@ GitLabSaver.prototype.save = function(text,method,callback) {
}
var requestType = "POST";
if(xhr.status !== 404) {
getResponseData = JSON.parse(getResponseDataJson);
getResponseData = $tw.utils.parseJSONSafe(getResponseDataJson);
$tw.utils.each(getResponseData,function(details) {
if(details.name === filename) {
requestType = "PUT";
@@ -67,7 +67,7 @@ GitLabSaver.prototype.save = function(text,method,callback) {
});
}
var data = {
commit_message: $tw.language.getRawString("ControlPanel/Saving/GitService/CommitMessage"),
commit_message: $tw.language.getString("ControlPanel/Saving/GitService/CommitMessage"),
content: text,
branch: branch,
sha: sha
@@ -82,7 +82,7 @@ GitLabSaver.prototype.save = function(text,method,callback) {
if(err) {
return callback(err);
}
var putResponseData = JSON.parse(putResponseDataJson);
var putResponseData = $tw.utils.parseJSONSafe(putResponseDataJson);
callback(null);
}
});

View File

@@ -43,7 +43,7 @@ TiddlyFoxSaver.prototype.save = function(text,method,callback) {
}
// Create the message element and put it in the message box
var message = document.createElement("div");
message.setAttribute("data-tiddlyfox-path",decodeURIComponent(pathname));
message.setAttribute("data-tiddlyfox-path",$tw.utils.decodeURIComponentSafe(pathname));
message.setAttribute("data-tiddlyfox-content",text);
messageBox.appendChild(message);
// Add an event handler for when the file has been saved

View File

@@ -21,7 +21,7 @@ TWEditSaver.prototype.save = function(text,method,callback) {
return false;
}
// Get the pathname of this document
var pathname = decodeURIComponent(document.location.pathname);
var pathname = $tw.utils.decodeURIComponentSafe(document.location.pathname);
// Strip any query or location part
var p = pathname.indexOf("?");
if(p !== -1) {

View File

@@ -17,7 +17,7 @@ exports.method = "DELETE";
exports.path = /^\/bags\/default\/tiddlers\/(.+)$/;
exports.handler = function(request,response,state) {
var title = decodeURIComponent(state.params[0]);
var title = $tw.utils.decodeURIComponentSafe(state.params[0]);
state.wiki.deleteTiddler(title);
response.writeHead(204, "OK", {
"Content-Type": "text/plain"

View File

@@ -20,22 +20,29 @@ exports.handler = function(request,response,state) {
var path = require("path"),
fs = require("fs"),
util = require("util"),
suppliedFilename = decodeURIComponent(state.params[0]),
filename = path.resolve(state.boot.wikiPath,"files",suppliedFilename),
suppliedFilename = $tw.utils.decodeURIComponentSafe(state.params[0]),
baseFilename = path.resolve(state.boot.wikiPath,"files"),
filename = path.resolve(baseFilename,suppliedFilename),
extension = path.extname(filename);
fs.readFile(filename,function(err,content) {
var status,content,type = "text/plain";
if(err) {
console.log("Error accessing file " + filename + ": " + err.toString());
status = 404;
content = "File '" + suppliedFilename + "' not found";
} else {
status = 200;
content = content;
type = ($tw.config.fileExtensionInfo[extension] ? $tw.config.fileExtensionInfo[extension].type : "application/octet-stream");
}
state.sendResponse(status,{"Content-Type": type},content);
});
// Check that the filename is inside the wiki files folder
if(path.relative(baseFilename,filename).indexOf("..") !== 0) {
// Send the file
fs.readFile(filename,function(err,content) {
var status,content,type = "text/plain";
if(err) {
console.log("Error accessing file " + filename + ": " + err.toString());
status = 404;
content = "File '" + suppliedFilename + "' not found";
} else {
status = 200;
content = content;
type = ($tw.config.fileExtensionInfo[extension] ? $tw.config.fileExtensionInfo[extension].type : "application/octet-stream");
}
state.sendResponse(status,{"Content-Type": type},content);
});
} else {
state.sendResponse(404,{"Content-Type": "text/plain"},"File '" + suppliedFilename + "' not found");
}
};
}());

View File

@@ -21,7 +21,6 @@ exports.handler = function(request,response,state) {
username: state.authenticatedUsername || state.server.get("anon-username") || "",
anonymous: !state.authenticatedUsername,
read_only: !state.server.isAuthorized("writers",state.authenticatedUsername),
sse_enabled: state.server.get("sse-enabled") === "yes",
space: {
recipe: "default"
},

View File

@@ -17,7 +17,7 @@ exports.method = "GET";
exports.path = /^\/([^\/]+)$/;
exports.handler = function(request,response,state) {
var title = decodeURIComponent(state.params[0]),
var title = $tw.utils.decodeURIComponentSafe(state.params[0]),
tiddler = state.wiki.getTiddler(title);
if(tiddler) {
var renderType = tiddler.getFieldString("_render_type"),

View File

@@ -17,7 +17,7 @@ exports.method = "GET";
exports.path = /^\/recipes\/default\/tiddlers\/(.+)$/;
exports.handler = function(request,response,state) {
var title = decodeURIComponent(state.params[0]),
var title = $tw.utils.decodeURIComponentSafe(state.params[0]),
tiddler = state.wiki.getTiddler(title),
tiddlerFields = {},
knownFields = [

View File

@@ -17,8 +17,8 @@ exports.method = "PUT";
exports.path = /^\/recipes\/default\/tiddlers\/(.+)$/;
exports.handler = function(request,response,state) {
var title = decodeURIComponent(state.params[0]),
fields = JSON.parse(state.data);
var title = $tw.utils.decodeURIComponentSafe(state.params[0]),
fields = $tw.utils.parseJSONSafe(state.data);
// Pull up any subfields in the `fields` object
if(fields.fields) {
$tw.utils.each(fields.fields,function(field,name) {
@@ -30,7 +30,7 @@ exports.handler = function(request,response,state) {
if(fields.revision) {
delete fields.revision;
}
state.wiki.addTiddler(new $tw.Tiddler(state.wiki.getCreationFields(),fields,{title: title},state.wiki.getModificationFields()));
state.wiki.addTiddler(new $tw.Tiddler(fields,{title: title}));
var changeCount = state.wiki.getChangeCount(title).toString();
response.writeHead(204, "OK",{
Etag: "\"default/" + encodeURIComponent(title) + "/" + changeCount + ":\"",

View File

@@ -1,70 +0,0 @@
/*\
title: $:/core/modules/server/server-sent-events.js
type: application/javascript
module-type: library
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
parameters:
prefix - usually the plugin path, such as `plugins/tiddlywiki/tiddlyweb`. The
route will match `/events/${prefix}` exactly.
handler - a function that will be called each time a request comes in with the
request and state from the route and an emit function to call.
*/
var ServerSentEvents = function ServerSentEvents(prefix, handler) {
this.handler = handler;
this.prefix = prefix;
};
ServerSentEvents.prototype.getExports = function() {
return {
bodyFormat: "stream",
method: "GET",
path: new RegExp("^/events/" + this.prefix + "$"),
handler: this.handleEventRequest.bind(this)
};
};
ServerSentEvents.prototype.handleEventRequest = function(request,response,state) {
if(ServerSentEvents.prototype.isEventStreamRequest(request)) {
response.writeHead(200, {
"Content-Type": "text/event-stream",
"Cache-Control": "no-cache",
"Connection": "keep-alive"
});
this.handler(request,state,this.emit.bind(this,response),this.end.bind(this,response));
} else {
response.writeHead(406,"Not Acceptable",{});
response.end();
}
};
ServerSentEvents.prototype.isEventStreamRequest = function(request) {
return request.headers.accept &&
request.headers.accept.match(/^text\/event-stream/);
};
ServerSentEvents.prototype.emit = function(response,event,data) {
if(typeof event !== "string" || event.indexOf("\n") !== -1) {
throw new Error("Type must be a single-line string");
}
if(typeof data !== "string" || data.indexOf("\n") !== -1) {
throw new Error("Data must be a single-line string");
}
response.write("event: " + event + "\ndata: " + data + "\n\n", "utf8");
};
ServerSentEvents.prototype.end = function(response) {
response.end();
};
exports.ServerSentEvents = ServerSentEvents;
})();

View File

@@ -34,7 +34,6 @@ function Server(options) {
this.authenticators = options.authenticators || [];
this.wiki = options.wiki;
this.boot = options.boot || $tw.boot;
this.servername = $tw.utils.transliterateToSafeASCII(this.wiki.getTiddlerText("$:/SiteTitle") || "TiddlyWiki5");
// Initialise the variables
this.variables = $tw.utils.extend({},this.defaultVariables);
if(options.variables) {
@@ -44,7 +43,8 @@ function Server(options) {
}
}
}
$tw.utils.extend({},this.defaultVariables,options.variables);
// Setup the default required plugins
this.requiredPlugins = this.get("required-plugins").split(',');
// Initialise CSRF
this.csrfDisable = this.get("csrf-disable") === "yes";
// Initialize Gzip compression
@@ -52,14 +52,24 @@ function Server(options) {
// Initialize browser-caching
this.enableBrowserCache = this.get("use-browser-cache") === "yes";
// Initialise authorization
var authorizedUserName = (this.get("username") && this.get("password")) ? this.get("username") : "(anon)";
var authorizedUserName;
if(this.get("username") && this.get("password")) {
authorizedUserName = this.get("username");
} else if(this.get("credentials")) {
authorizedUserName = "(authenticated)";
} else {
authorizedUserName = "(anon)";
}
this.authorizationPrincipals = {
readers: (this.get("readers") || authorizedUserName).split(",").map($tw.utils.trim),
writers: (this.get("writers") || authorizedUserName).split(",").map($tw.utils.trim)
}
if(this.get("admin") || authorizedUserName !== "(anon)") {
this.authorizationPrincipals["admin"] = (this.get("admin") || authorizedUserName).split(',').map($tw.utils.trim)
}
// Load and initialise authenticators
$tw.modules.forEachModuleOfType("authenticator", function(title,authenticatorDefinition) {
// console.log("Loading server route " + title);
// console.log("Loading authenticator " + title);
self.addAuthenticator(authenticatorDefinition.AuthenticatorClass);
});
// Load route handlers
@@ -71,15 +81,21 @@ function Server(options) {
this.listenOptions = null;
this.protocol = "http";
var tlsKeyFilepath = this.get("tls-key"),
tlsCertFilepath = this.get("tls-cert");
tlsCertFilepath = this.get("tls-cert"),
tlsPassphrase = this.get("tls-passphrase");
if(tlsCertFilepath && tlsKeyFilepath) {
this.listenOptions = {
key: fs.readFileSync(path.resolve(this.boot.wikiPath,tlsKeyFilepath),"utf8"),
cert: fs.readFileSync(path.resolve(this.boot.wikiPath,tlsCertFilepath),"utf8")
cert: fs.readFileSync(path.resolve(this.boot.wikiPath,tlsCertFilepath),"utf8"),
passphrase: tlsPassphrase || ''
};
this.protocol = "https";
}
this.transport = require(this.protocol);
// Name the server and init the boot state
this.servername = $tw.utils.transliterateToSafeASCII(this.get("server-name") || this.wiki.getTiddlerText("$:/SiteTitle") || "TiddlyWiki5");
this.boot.origin = this.get("origin")? this.get("origin"): this.protocol+"://"+this.get("host")+":"+this.get("port");
this.boot.pathPrefix = this.get("path-prefix") || "";
}
/*
@@ -150,6 +166,7 @@ function sendResponse(request,response,statusCode,headers,data,encoding) {
Server.prototype.defaultVariables = {
port: "8080",
host: "127.0.0.1",
"required-plugins": "$:/plugins/tiddlywiki/filesystem,$:/plugins/tiddlywiki/tiddlyweb",
"root-tiddler": "$:/core/save/all",
"root-render-type": "text/plain",
"root-serve-type": "text/html",
@@ -239,15 +256,15 @@ Server.prototype.requestHandler = function(request,response,options) {
state.pathPrefix = options.pathPrefix || this.get("path-prefix") || "";
state.sendResponse = sendResponse.bind(self,request,response);
// Get the principals authorized to access this resource
var authorizationType = this.methodMappings[request.method] || "readers";
state.authorizationType = options.authorizationType || this.methodMappings[request.method] || "readers";
// Check for the CSRF header if this is a write
if(!this.csrfDisable && authorizationType === "writers" && request.headers["x-requested-with"] !== "TiddlyWiki") {
if(!this.csrfDisable && state.authorizationType === "writers" && request.headers["x-requested-with"] !== "TiddlyWiki") {
response.writeHead(403,"'X-Requested-With' header required to login to '" + this.servername + "'");
response.end();
return;
}
// Check whether anonymous access is granted
state.allowAnon = this.isAuthorized(authorizationType,null);
state.allowAnon = this.isAuthorized(state.authorizationType,null);
// Authenticate with the first active authenticator
if(this.authenticators.length > 0) {
if(!this.authenticators[0].authenticateRequest(request,response,state)) {
@@ -256,7 +273,7 @@ Server.prototype.requestHandler = function(request,response,options) {
}
}
// Authorize with the authenticated username
if(!this.isAuthorized(authorizationType,state.authenticatedUsername)) {
if(!this.isAuthorized(state.authorizationType,state.authenticatedUsername)) {
response.writeHead(401,"'" + state.authenticatedUsername + "' is not authorized to access '" + this.servername + "'");
response.end();
return;
@@ -322,8 +339,16 @@ Server.prototype.listen = function(port,host,prefix) {
port = process.env[port] || 8080;
}
// Warn if required plugins are missing
if(!this.wiki.getTiddler("$:/plugins/tiddlywiki/tiddlyweb") || !this.wiki.getTiddler("$:/plugins/tiddlywiki/filesystem")) {
$tw.utils.warning("Warning: Plugins required for client-server operation (\"tiddlywiki/filesystem\" and \"tiddlywiki/tiddlyweb\") are missing from tiddlywiki.info file");
var missing = [];
for (var index=0; index<this.requiredPlugins.length; index++) {
if (!this.wiki.getTiddler(this.requiredPlugins[index])) {
missing.push(this.requiredPlugins[index]);
}
}
if(missing.length > 0) {
var error = "Warning: Plugin(s) required for client-server operation are missing.\n"+
"\""+ missing.join("\", \"")+"\"";
$tw.utils.warning(error);
}
// Create the server
var server;

View File

@@ -152,7 +152,7 @@ exports.startup = function() {
if(event.data.status.charAt(0) === "2") {
if(event.data.cookies) {
if(event.data.cookies.type === "save-info") {
var tiddlers = JSON.parse(event.data.body);
var tiddlers = $tw.utils.parseJSONSafe(event.data.body);
$tw.utils.each(tiddlers,function(tiddler) {
$tw.wiki.addTiddler(new $tw.Tiddler($tw.wiki.getCreationFields(),tiddler,{
title: event.data.cookies.infoTitlePrefix + event.data.cookies.url + "/" + tiddler.title,
@@ -170,7 +170,7 @@ exports.startup = function() {
},$tw.wiki.getModificationFields()));
});
} else if(event.data.cookies.type === "save-tiddler") {
var tiddler = JSON.parse(event.data.body);
var tiddler = $tw.utils.parseJSONSafe(event.data.body);
$tw.wiki.addTiddler(new $tw.Tiddler(tiddler));
}
}

View File

@@ -51,6 +51,20 @@ exports.startup = function() {
element.focus(event.paramObject);
}
});
// Install the tm-rename-tiddler and tm-relink-tiddler messages
var makeRenameHandler = function(method) {
return function(event) {
var options = {},
paramObject = event.paramObject || {},
from = paramObject.from || event.tiddlerTitle,
to = paramObject.to;
options.dontRenameInTags = (paramObject.renameInTags === "false" || paramObject.renameInTags === "no") ? true : false;
options.dontRenameInLists = (paramObject.renameInLists === "false" || paramObject.renameInLists === "no") ? true : false;
$tw.wiki[method](from,to,options);
};
};
$tw.rootWidget.addEventListener("tm-rename-tiddler",makeRenameHandler("renameTiddler"));
$tw.rootWidget.addEventListener("tm-relink-tiddler",makeRenameHandler("relinkTiddler"));
// Install the scroller
$tw.pageScroller = new $tw.utils.PageScroller();
$tw.rootWidget.addEventListener("tm-scroll",function(event) {

View File

@@ -120,10 +120,10 @@ function openStartupTiddlers(options) {
var hash = $tw.locationHash.substr(1),
split = hash.indexOf(":");
if(split === -1) {
target = decodeURIComponent(hash.trim());
target = $tw.utils.decodeURIComponentSafe(hash.trim());
} else {
target = decodeURIComponent(hash.substr(0,split).trim());
storyFilter = decodeURIComponent(hash.substr(split + 1).trim());
target = $tw.utils.decodeURIComponentSafe(hash.substr(0,split).trim());
storyFilter = $tw.utils.decodeURIComponentSafe(hash.substr(split + 1).trim());
}
}
// If the story wasn't specified use the current tiddlers or a blank story

View File

@@ -20,6 +20,8 @@ exports.synchronous = true;
// Global to keep track of open windows (hashmap by title)
$tw.windows = {};
// Default template to use for new windows
var DEFAULT_WINDOW_TEMPLATE = "$:/core/templates/single.tiddler.window";
exports.startup = function() {
// Handle open window message
@@ -29,22 +31,25 @@ exports.startup = function() {
title = event.param || event.tiddlerTitle,
paramObject = event.paramObject || {},
windowTitle = paramObject.windowTitle || title,
template = paramObject.template || "$:/core/templates/single.tiddler.window",
windowID = paramObject.windowID || title,
template = paramObject.template || DEFAULT_WINDOW_TEMPLATE,
width = paramObject.width || "700",
height = paramObject.height || "600",
variables = $tw.utils.extend({},paramObject,{currentTiddler: title});
top = paramObject.top,
left = paramObject.left,
variables = $tw.utils.extend({},paramObject,{currentTiddler: title, "tv-window-id": windowID});
// Open the window
var srcWindow,
srcDocument;
// In case that popup blockers deny opening a new window
try {
srcWindow = window.open("","external-" + title,"scrollbars,width=" + width + ",height=" + height),
srcWindow = window.open("","external-" + windowID,"scrollbars,width=" + width + ",height=" + height + (top ? ",top=" + top : "" ) + (left ? ",left=" + left : "" )),
srcDocument = srcWindow.document;
}
catch(e) {
return;
}
$tw.windows[title] = srcWindow;
$tw.windows[windowID] = srcWindow;
// Check for reopening the same window
if(srcWindow.haveInitialisedWindow) {
return;
@@ -54,7 +59,7 @@ exports.startup = function() {
srcDocument.close();
srcDocument.title = windowTitle;
srcWindow.addEventListener("beforeunload",function(event) {
delete $tw.windows[title];
delete $tw.windows[windowID];
$tw.wiki.removeEventListener("change",refreshHandler);
},false);
// Set up the styles
@@ -88,13 +93,21 @@ exports.startup = function() {
srcWindow.document.documentElement.addEventListener("click",$tw.popup,true);
srcWindow.haveInitialisedWindow = true;
});
// Close open windows when unloading main window
$tw.addUnloadTask(function() {
$tw.rootWidget.addEventListener("tm-close-window",function(event) {
var windowID = event.param,
win = $tw.windows[windowID];
if(win) {
win.close();
}
});
var closeAllWindows = function() {
$tw.utils.each($tw.windows,function(win) {
win.close();
});
});
}
$tw.rootWidget.addEventListener("tm-close-all-windows",closeAllWindows);
// Close open windows when unloading main window
$tw.addUnloadTask(closeAllWindows);
};
})();

View File

@@ -20,7 +20,6 @@ Syncer.prototype.titleIsAnonymous = "$:/status/IsAnonymous";
Syncer.prototype.titleIsReadOnly = "$:/status/IsReadOnly";
Syncer.prototype.titleUserName = "$:/status/UserName";
Syncer.prototype.titleSyncFilter = "$:/config/SyncFilter";
Syncer.prototype.titleSyncDisablePolling = "$:/config/SyncDisablePolling";
Syncer.prototype.titleSyncPollingInterval = "$:/config/SyncPollingInterval";
Syncer.prototype.titleSyncDisableLazyLoading = "$:/config/SyncDisableLazyLoading";
Syncer.prototype.titleSavedNotification = "$:/language/Notifications/Save/Done";
@@ -90,7 +89,7 @@ function Syncer(options) {
if(filteredChanges.length > 0) {
self.processTaskQueue();
} else {
// Look for deletions of tiddlers we're already syncing
// Look for deletions of tiddlers we're already syncing
var outstandingDeletion = false
$tw.utils.each(changes,function(change,title,object) {
if(change.deleted && $tw.utils.hop(self.tiddlerInfo,title)) {
@@ -122,7 +121,7 @@ function Syncer(options) {
self.login(username,password,function() {});
} else {
// No username and password, so we display a prompt
self.handleLoginEvent();
self.handleLoginEvent();
}
});
$tw.rootWidget.addEventListener("tm-logout",function() {
@@ -139,7 +138,7 @@ function Syncer(options) {
if(!this.disableUI && this.wiki.getTiddlerText(this.titleSyncDisableLazyLoading) !== "yes") {
this.wiki.addEventListener("lazyLoad",function(title) {
self.handleLazyLoadEvent(title);
});
});
}
// Get the login status
this.getStatus(function(err,isLoggedIn) {
@@ -174,8 +173,8 @@ Syncer.prototype.getTiddlerRevision = function(title) {
if(this.syncadaptor && this.syncadaptor.getTiddlerRevision) {
return this.syncadaptor.getTiddlerRevision(title);
} else {
return this.wiki.getTiddler(title).fields.revision;
}
return this.wiki.getTiddler(title).fields.revision;
}
};
/*
@@ -268,9 +267,9 @@ Syncer.prototype.getStatus = function(callback) {
// Mark us as not logged in
this.wiki.addTiddler({title: this.titleIsLoggedIn,text: "no"});
// Get login status
this.syncadaptor.getStatus(function(err,isLoggedIn,username,isReadOnly,isAnonymous,isPollingDisabled) {
this.syncadaptor.getStatus(function(err,isLoggedIn,username,isReadOnly,isAnonymous) {
if(err) {
self.logger.alert(err);
self.displayError("Get Status Error",err);
} else {
// Set the various status tiddlers
self.wiki.addTiddler({title: self.titleIsReadOnly,text: isReadOnly ? "yes" : "no"});
@@ -279,9 +278,6 @@ Syncer.prototype.getStatus = function(callback) {
if(isLoggedIn) {
self.wiki.addTiddler({title: self.titleUserName,text: username || ""});
}
if(isPollingDisabled) {
self.wiki.addTiddler({title: self.titleSyncDisablePolling, text: "yes"});
}
}
// Invoke the callback
if(callback) {
@@ -305,15 +301,12 @@ Syncer.prototype.syncFromServer = function() {
}
},
triggerNextSync = function() {
if(pollingEnabled) {
self.pollTimerId = setTimeout(function() {
self.pollTimerId = null;
self.syncFromServer.call(self);
},self.pollTimerInterval);
}
self.pollTimerId = setTimeout(function() {
self.pollTimerId = null;
self.syncFromServer.call(self);
},self.pollTimerInterval);
},
syncSystemFromServer = (self.wiki.getTiddlerText("$:/config/SyncSystemTiddlersFromServer") === "yes"),
pollingEnabled = (self.wiki.getTiddlerText(self.titleSyncDisablePolling) !== "yes");
syncSystemFromServer = (self.wiki.getTiddlerText("$:/config/SyncSystemTiddlersFromServer") === "yes" ? true : false);
if(this.syncadaptor && this.syncadaptor.getUpdatedTiddlers) {
this.logger.log("Retrieving updated tiddler list");
cancelNextSync();
@@ -336,7 +329,7 @@ Syncer.prototype.syncFromServer = function() {
});
if(updates.modifications.length > 0 || updates.deletions.length > 0) {
self.processTaskQueue();
}
}
}
});
} else if(this.syncadaptor && this.syncadaptor.getSkinnyTiddlers) {
@@ -479,7 +472,7 @@ Syncer.prototype.handleLogoutEvent = function() {
if(this.syncadaptor.logout) {
this.syncadaptor.logout(function(err) {
if(err) {
self.logger.alert(err);
self.displayError("Logout Error",err);
} else {
self.getStatus();
}
@@ -516,7 +509,7 @@ Syncer.prototype.processTaskQueue = function() {
} else {
self.updateDirtyStatus();
// Process the next task
self.processTaskQueue.call(self);
self.processTaskQueue.call(self);
}
});
} else {
@@ -524,11 +517,11 @@ Syncer.prototype.processTaskQueue = function() {
this.updateDirtyStatus();
// And trigger a timeout if there is a pending task
if(task === true) {
this.triggerTimeout();
this.triggerTimeout();
}
}
} else {
this.updateDirtyStatus();
this.updateDirtyStatus();
}
};
@@ -562,7 +555,7 @@ Syncer.prototype.chooseNextTask = function() {
isReadyToSave = !tiddlerInfo || !tiddlerInfo.timestampLastSaved || tiddlerInfo.timestampLastSaved < thresholdLastSaved;
if(hasChanged) {
if(isReadyToSave) {
return new SaveTiddlerTask(this,title);
return new SaveTiddlerTask(this,title);
} else {
havePending = true;
}

View File

@@ -24,13 +24,13 @@ exports.isDraft = function() {
return this.hasField("draft.of");
};
exports.getFieldString = function(field) {
exports.getFieldString = function(field,defaultValue) {
var value = this.fields[field];
// Check for a missing field
if(value === undefined || value === null) {
return "";
return defaultValue || "";
}
// Parse the field with the associated module (if any)
// Stringify the field with the associated tiddler field module (if any)
var fieldModule = $tw.Tiddler.fieldModules[field];
if(fieldModule && fieldModule.stringify) {
return fieldModule.stringify.call(this,value);

View File

@@ -41,7 +41,7 @@ exports.upgrade = function(wiki,titles,tiddlers) {
// Check if we're dealing with a plugin
if(incomingTiddler && incomingTiddler["plugin-type"]) {
// Check whether the plugin contains JS modules
var requiresReload = wiki.doesPluginInfoRequireReload(JSON.parse(incomingTiddler.text)) ? (wiki.getTiddlerText("$:/language/ControlPanel/Plugins/PluginWillRequireReload") + " ") : "";
var requiresReload = wiki.doesPluginInfoRequireReload($tw.utils.parseJSONSafe(incomingTiddler.text)) ? (wiki.getTiddlerText("$:/language/ControlPanel/Plugins/PluginWillRequireReload") + " ") : "";
messages[title] = requiresReload;
if(incomingTiddler.version) {
// Upgrade the incoming plugin if it is in the upgrade library

View File

@@ -21,7 +21,7 @@ exports.extractEncryptedStoreArea = function(text) {
if(encryptedStoreAreaStart !== -1) {
var encryptedStoreAreaEnd = text.indexOf("</pre>",encryptedStoreAreaStart);
if(encryptedStoreAreaEnd !== -1) {
return $tw.utils.htmlDecode(text.substring(encryptedStoreAreaStart + encryptedStoreAreaStartMarker.length,encryptedStoreAreaEnd-1));
return $tw.utils.htmlDecode(text.substring(encryptedStoreAreaStart + encryptedStoreAreaStartMarker.length,encryptedStoreAreaEnd));
}
}
return null;
@@ -33,7 +33,7 @@ Attempt to extract the tiddlers from an encrypted store area using the current p
exports.decryptStoreArea = function(encryptedStoreArea,password) {
var decryptedText = $tw.crypto.decrypt(encryptedStoreArea,password);
if(decryptedText) {
var json = JSON.parse(decryptedText),
var json = $tw.utils.parseJSONSafe(decryptedText),
tiddlers = [];
for(var title in json) {
if(title !== "$:/isEncrypted") {

View File

@@ -16,21 +16,23 @@ Browser data transfer utilities, used with the clipboard and drag and drop
Options:
domNode: dom node to make draggable
dragImageType: "pill" or "dom"
selector: CSS selector to identify element within domNode to be used as drag handle (optional)
dragImageType: "pill", "blank" or "dom" (the default)
dragTiddlerFn: optional function to retrieve the title of tiddler to drag
dragFilterFn: optional function to retreive the filter defining a list of tiddlers to drag
widget: widget to use as the contect for the filter
widget: widget to use as the context for the filter
*/
exports.makeDraggable = function(options) {
var dragImageType = options.dragImageType || "dom",
dragImage,
domNode = options.domNode;
domNode = options.domNode,
dragHandle = options.selector && domNode.querySelector(options.selector) || domNode;
// Make the dom node draggable (not necessary for anchor tags)
if((domNode.tagName || "").toLowerCase() !== "a") {
domNode.setAttribute("draggable","true");
dragHandle.setAttribute("draggable","true");
}
// Add event handlers
$tw.utils.addEventListeners(domNode,[
$tw.utils.addEventListeners(dragHandle,[
{name: "dragstart", handlerFunction: function(event) {
if(event.dataTransfer === undefined) {
return false;
@@ -45,7 +47,7 @@ exports.makeDraggable = function(options) {
}
var titleString = $tw.utils.stringifyList(titles);
// Check that we've something to drag
if(titles.length > 0 && event.target === domNode) {
if(titles.length > 0 && event.target === dragHandle) {
// Mark the drag in progress
$tw.dragInProgress = domNode;
// Set the dragging class on the element being dragged
@@ -73,6 +75,9 @@ exports.makeDraggable = function(options) {
if(dataTransfer.setDragImage) {
if(dragImageType === "pill") {
dataTransfer.setDragImage(dragImage.firstChild,-16,-16);
} else if (dragImageType === "blank") {
dragImage.removeChild(dragImage.firstChild);
dataTransfer.setDragImage(dragImage,0,0);
} else {
var r = domNode.getBoundingClientRect();
dataTransfer.setDragImage(domNode,event.clientX-r.left,event.clientY-r.top);
@@ -164,7 +169,7 @@ var importDataTypes = [
}},
{type: "URL", IECompatible: true, toTiddlerFieldsArray: function(data,fallbackTitle) {
// Check for tiddler data URI
var match = decodeURIComponent(data).match(/^data\:text\/vnd\.tiddler,(.*)/i);
var match = $tw.utils.decodeURIComponentSafe(data).match(/^data\:text\/vnd\.tiddler,(.*)/i);
if(match) {
return parseJSONTiddlers(match[1],fallbackTitle);
} else {
@@ -173,7 +178,7 @@ var importDataTypes = [
}},
{type: "text/x-moz-url", IECompatible: false, toTiddlerFieldsArray: function(data,fallbackTitle) {
// Check for tiddler data URI
var match = decodeURIComponent(data).match(/^data\:text\/vnd\.tiddler,(.*)/i);
var match = $tw.utils.decodeURIComponentSafe(data).match(/^data\:text\/vnd\.tiddler,(.*)/i);
if(match) {
return parseJSONTiddlers(match[1],fallbackTitle);
} else {
@@ -195,7 +200,7 @@ var importDataTypes = [
];
function parseJSONTiddlers(json,fallbackTitle) {
var data = JSON.parse(json);
var data = $tw.utils.parseJSONSafe(json);
if(!$tw.utils.isArray(data)) {
data = [data];
}
@@ -205,10 +210,10 @@ function parseJSONTiddlers(json,fallbackTitle) {
return data;
};
exports.dragEventContainsFiles = function(event) {
function dragEventContainsType(event,targetType) {
if(event.dataTransfer.types) {
for(var i=0; i<event.dataTransfer.types.length; i++) {
if(event.dataTransfer.types[i] === "Files") {
if(event.dataTransfer.types[i] === targetType) {
return true;
break;
}
@@ -217,4 +222,10 @@ exports.dragEventContainsFiles = function(event) {
return false;
};
exports.dragEventContainsFiles = function(event) {
return (dragEventContainsType(event,"Files") && !dragEventContainsType(event,"text/plain"));
};
exports.dragEventContainsType = dragEventContainsType;
})();

View File

@@ -34,6 +34,23 @@ exports.httpRequest = function(options) {
});
return result;
},
getHeader = function(targetHeader) {
return headers[targetHeader] || headers[targetHeader.toLowerCase()];
},
isSimpleRequest = function(type,headers) {
if(["GET","HEAD","POST"].indexOf(type) === -1) {
return false;
}
for(var header in headers) {
if(["accept","accept-language","content-language","content-type"].indexOf(header.toLowerCase()) === -1) {
return false;
}
}
if(hasHeader("Content-Type") && ["application/x-www-form-urlencoded","multipart/form-data","text/plain"].indexOf(getHeader["Content-Type"]) === -1) {
return false;
}
return true;
},
returnProp = options.returnProp || "responseText",
request = new XMLHttpRequest(),
data = "",
@@ -76,7 +93,7 @@ exports.httpRequest = function(options) {
if(data && !hasHeader("Content-Type")) {
request.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
}
if(!hasHeader("X-Requested-With")) {
if(!hasHeader("X-Requested-With") && !isSimpleRequest(type,headers)) {
request.setRequestHeader("X-Requested-With","TiddlyWiki");
}
try {

View File

@@ -49,10 +49,14 @@ Handle an event
*/
PageScroller.prototype.handleEvent = function(event) {
if(event.type === "tm-scroll") {
var options = {};
if($tw.utils.hop(event.paramObject,"animationDuration")) {
options.animationDuration = event.paramObject.animationDuration;
}
if(event.paramObject && event.paramObject.selector) {
this.scrollSelectorIntoView(null,event.paramObject.selector);
this.scrollSelectorIntoView(null,event.paramObject.selector,null,options);
} else {
this.scrollIntoView(event.target);
this.scrollIntoView(event.target,null,options);
}
return false; // Event was handled
}
@@ -62,10 +66,10 @@ PageScroller.prototype.handleEvent = function(event) {
/*
Handle a scroll event hitting the page document
*/
PageScroller.prototype.scrollIntoView = function(element,callback) {
PageScroller.prototype.scrollIntoView = function(element,callback,options) {
var self = this,
duration = $tw.utils.getAnimationDuration(),
srcWindow = element ? element.ownerDocument.defaultView : window;
duration = $tw.utils.hop(options,"animationDuration") ? parseInt(options.animationDuration) : $tw.utils.getAnimationDuration(),
srcWindow = element ? element.ownerDocument.defaultView : window;
// Now get ready to scroll the body
this.cancelScroll(srcWindow);
this.startTime = Date.now();
@@ -122,11 +126,11 @@ PageScroller.prototype.scrollIntoView = function(element,callback) {
drawFrame();
};
PageScroller.prototype.scrollSelectorIntoView = function(baseElement,selector,callback) {
PageScroller.prototype.scrollSelectorIntoView = function(baseElement,selector,callback,options) {
baseElement = baseElement || document.body;
var element = baseElement.querySelector(selector);
if(element) {
this.scrollIntoView(element,callback);
this.scrollIntoView(element,callback,options);
}
};

View File

@@ -30,11 +30,7 @@ exports.getEditionInfo = function() {
var entry = entries[entryIndex];
// Check if directories have a valid tiddlywiki.info
if(!editionInfo[entry] && $tw.utils.isDirectory(path.resolve(editionPath,entry))) {
var info;
try {
info = JSON.parse(fs.readFileSync(path.resolve(editionPath,entry,"tiddlywiki.info"),"utf8"));
} catch(ex) {
}
var info = $tw.utils.parseJSONSafe(fs.readFileSync(path.resolve(editionPath,entry,"tiddlywiki.info"),"utf8"),null);
if(info) {
editionInfo[entry] = info;
}

View File

@@ -235,7 +235,7 @@ Object.defineProperty(TW_Element.prototype, "innerHTML", {
if(node instanceof TW_Element) {
b.push(node.outerHTML);
} else if(node instanceof TW_TextNode) {
b.push($tw.utils.htmlEncode(node.textContent));
b.push($tw.utils.htmlTextEncode(node.textContent));
}
});
return b.join("");

View File

@@ -95,6 +95,15 @@ LinkedList.prototype.toArray = function() {
return output;
};
LinkedList.prototype.makeTiddlerIterator = function(wiki) {
var self = this;
return function(callback) {
self.each(function(title) {
callback(wiki.getTiddler(title),title);
});
};
};
function _removeOne(list,value) {
var prevEntry = list.prev[value],
nextEntry = list.next[value],

View File

@@ -24,10 +24,8 @@ exports.repackPlugin = function(title,additionalTiddlers,excludeTiddlers) {
throw "No such tiddler as " + title;
}
// Extract the JSON
var jsonPluginTiddler;
try {
jsonPluginTiddler = JSON.parse(pluginTiddler.fields.text);
} catch(e) {
var jsonPluginTiddler = $tw.utils.parseJSONSafe(pluginTiddler.fields.text,null);
if(!jsonPluginTiddler) {
throw "Cannot parse plugin tiddler " + title + "\n" + $tw.language.getString("Error/Caption") + ": " + e;
}
// Get the list of tiddlers

View File

@@ -199,6 +199,8 @@ exports.transliterationPairs = {
"Nj":"N",
"Ñ":"N",
"NJ":"NJ",
"ð":"d",
"Ð":"D",
"Ó":"O",
"Ŏ":"O",
"Ǒ":"O",
@@ -265,6 +267,8 @@ exports.transliterationPairs = {
"Ɽ":"R",
"Ꜿ":"C",
"Ǝ":"E",
"ß":"ss",
"ẞ":"SS",
"Ś":"S",
"Ṥ":"S",
"Š":"S",
@@ -275,6 +279,8 @@ exports.transliterationPairs = {
"Ṡ":"S",
"Ṣ":"S",
"Ṩ":"S",
"þ": "th",
"Þ": "TH",
"Ť":"T",
"Ţ":"T",
"Ṱ":"T",
@@ -907,7 +913,8 @@ exports.transliterationPairs = {
"т":"t",
"ь":"'",
"б":"b",
"ю":"yu"
"ю":"yu",
"…":"..."
};
exports.transliterate = function(str) {

View File

@@ -383,6 +383,15 @@ exports.formatDateString = function(date,template) {
[/^0WW/, function() {
return $tw.utils.pad($tw.utils.getWeek(date));
}],
[/^0ddddd/, function() {
return $tw.utils.pad(Math.floor((date - new Date(date.getFullYear(), 0, 0)) / 1000 / 60 / 60 / 24),3);
}],
[/^ddddd/, function() {
return Math.floor((date - new Date(date.getFullYear(), 0, 0)) / 1000 / 60 / 60 / 24);
}],
[/^dddd/, function() {
return [7,1,2,3,4,5,6][date.getDay()];
}],
[/^ddd/, function() {
return $tw.language.getString("Date/Short/Day/" + date.getDay());
}],

View File

@@ -59,7 +59,7 @@ Invoke the action associated with this widget
ConfirmWidget.prototype.invokeAction = function(triggeringWidget,event) {
var invokeActions = true,
handled = true,
win = event.event && event.event.view ? event.event.view : window;
win = event && event.event && event.event.view ? event.event.view : window;
if(this.prompt) {
invokeActions = win.confirm(this.message);
}

View File

@@ -39,6 +39,8 @@ SendMessageWidget.prototype.execute = function() {
this.actionParam = this.getAttribute("$param");
this.actionName = this.getAttribute("$name");
this.actionValue = this.getAttribute("$value","");
this.actionNames = this.getAttribute("$names");
this.actionValues = this.getAttribute("$values");
};
/*
@@ -59,13 +61,20 @@ Invoke the action associated with this widget
SendMessageWidget.prototype.invokeAction = function(triggeringWidget,event) {
// Get the string parameter
var param = this.actionParam;
// Assemble the attributes as a hashmap
// Assemble the parameters as a hashmap
var paramObject = Object.create(null);
var count = 0;
// Add names/values pairs if present
if(this.actionNames && this.actionValues) {
var names = this.wiki.filterTiddlers(this.actionNames,this),
values = this.wiki.filterTiddlers(this.actionValues,this);
$tw.utils.each(names,function(name,index) {
paramObject[name] = values[index] || "";
});
}
// Add raw parameters
$tw.utils.each(this.attributes,function(attribute,name) {
if(name.charAt(0) !== "$") {
paramObject[name] = attribute;
count++;
}
});
// Add name/value pair if present
@@ -73,14 +82,15 @@ SendMessageWidget.prototype.invokeAction = function(triggeringWidget,event) {
paramObject[this.actionName] = this.actionValue;
}
// Dispatch the message
this.dispatchEvent({
var params = {
type: this.actionMessage,
param: param,
paramObject: paramObject,
event: event,
tiddlerTitle: this.getVariable("currentTiddler"),
navigateFromTitle: this.getVariable("storyTiddler"),
event: event
});
navigateFromTitle: this.getVariable("storyTiddler")
};
this.dispatchEvent(params);
return true; // Action was invoked
};

View File

@@ -0,0 +1,86 @@
/*\
title: $:/core/modules/widgets/action-setmultiplefields.js
type: application/javascript
module-type: widget
Action widget to set multiple fields or indexes on a tiddler
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var Widget = require("$:/core/modules/widgets/widget.js").widget;
var SetMultipleFieldsWidget = function(parseTreeNode,options) {
this.initialise(parseTreeNode,options);
};
/*
Inherit from the base widget class
*/
SetMultipleFieldsWidget.prototype = new Widget();
/*
Render this widget into the DOM
*/
SetMultipleFieldsWidget.prototype.render = function(parent,nextSibling) {
this.computeAttributes();
this.execute();
};
/*
Compute the internal state of the widget
*/
SetMultipleFieldsWidget.prototype.execute = function() {
this.actionTiddler = this.getAttribute("$tiddler",this.getVariable("currentTiddler"));
this.actionFields = this.getAttribute("$fields");
this.actionIndexes = this.getAttribute("$indexes");
this.actionValues = this.getAttribute("$values");
this.actionTimestamp = this.getAttribute("$timestamp","yes") === "yes";
};
/*
Refresh the widget by ensuring our attributes are up to date
*/
SetMultipleFieldsWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
if(changedAttributes["$tiddler"] || changedAttributes["$fields"] || changedAttributes["$indexes"] || changedAttributes["$values"] || changedAttributes["$timestamp"]) {
this.refreshSelf();
return true;
}
return this.refreshChildren(changedTiddlers);
};
/*
Invoke the action associated with this widget
*/
SetMultipleFieldsWidget.prototype.invokeAction = function(triggeringWidget,event) {
var tiddler = this.wiki.getTiddler(this.actionTiddler),
names, values = this.wiki.filterTiddlers(this.actionValues,this);
if(this.actionFields) {
var additions = {};
names = this.wiki.filterTiddlers(this.actionFields,this);
$tw.utils.each(names,function(fieldname,index) {
additions[fieldname] = values[index] || "";
});
var creationFields = this.actionTimestamp ? this.wiki.getCreationFields() : undefined,
modificationFields = this.actionTimestamp ? this.wiki.getModificationFields() : undefined;
this.wiki.addTiddler(new $tw.Tiddler(creationFields,tiddler,{title: this.actionTiddler},modificationFields,additions));
} else if(this.actionIndexes) {
var data = this.wiki.getTiddlerData(this.actionTiddler,Object.create(null));
names = this.wiki.filterTiddlers(this.actionIndexes,this);
$tw.utils.each(names,function(name,index) {
data[name] = values[index] || "";
});
this.wiki.setTiddlerData(this.actionTiddler,data,{},{suppressTimestamp: !this.actionTimestamp});
}
return true; // Action was invoked
};
exports["action-setmultiplefields"] = SetMultipleFieldsWidget;
})();

View File

@@ -52,7 +52,13 @@ CodeBlockWidget.prototype.execute = function() {
Selectively refreshes the widget if needed. Returns true if the widget or any of its children needed re-rendering
*/
CodeBlockWidget.prototype.refresh = function(changedTiddlers) {
return false;
var changedAttributes = this.computeAttributes();
if(changedAttributes.code || changedAttributes.language) {
this.refreshSelf();
return true;
} else {
return false;
}
};
exports.codeblock = CodeBlockWidget;

View File

@@ -27,7 +27,10 @@ DraggableWidget.prototype = new Widget();
Render this widget into the DOM
*/
DraggableWidget.prototype.render = function(parent,nextSibling) {
var self = this;
var self = this,
tag,
domNode,
classes = [];
// Save the parent dom node
this.parentDomNode = parent;
// Compute our attributes
@@ -35,18 +38,23 @@ DraggableWidget.prototype.render = function(parent,nextSibling) {
// Execute our logic
this.execute();
// Sanitise the specified tag
var tag = this.draggableTag;
tag = this.draggableTag;
if($tw.config.htmlUnsafeElements.indexOf(tag) !== -1) {
tag = "div";
}
// Create our element
var domNode = this.document.createElement(tag);
domNode = this.document.createElement(tag);
// Assign classes
var classes = ["tc-draggable"];
if(this.draggableClasses) {
classes.push(this.draggableClasses);
}
if(!this.dragHandleSelector) {
classes.push("tc-draggable");
}
domNode.setAttribute("class",classes.join(" "));
// Insert the node into the DOM and render any children
parent.insertBefore(domNode,nextSibling);
this.renderChildren(domNode,null);
// Add event handlers
$tw.utils.makeDraggable({
domNode: domNode,
@@ -54,11 +62,10 @@ DraggableWidget.prototype.render = function(parent,nextSibling) {
dragFilterFn: function() {return self.getAttribute("filter");},
startActions: self.startActions,
endActions: self.endActions,
widget: this
dragImageType: self.dragImageType,
widget: this,
selector: self.dragHandleSelector
});
// Insert the link into the DOM and render any children
parent.insertBefore(domNode,nextSibling);
this.renderChildren(domNode,null);
this.domNodes.push(domNode);
};
@@ -71,6 +78,8 @@ DraggableWidget.prototype.execute = function() {
this.draggableClasses = this.getAttribute("class");
this.startActions = this.getAttribute("startactions");
this.endActions = this.getAttribute("endactions");
this.dragImageType = this.getAttribute("dragimagetype");
this.dragHandleSelector = this.getAttribute("selector");
// Make the child widgets
this.makeChildWidgets();
};

View File

@@ -198,7 +198,8 @@ DropZoneWidget.prototype.handleDropEvent = function(event) {
this.resetState();
// Import any files in the drop
var numFiles = 0;
if(dataTransfer.files) {
// If we have type text/vnd.tiddlywiki then skip trying to import files
if(dataTransfer.files && !$tw.utils.dragEventContainsType(event,"text/vnd.tiddler")) {
numFiles = this.wiki.readFiles(dataTransfer.files,{
callback: readFileCallback,
deserializer: this.dropzoneDeserializer

View File

@@ -46,6 +46,7 @@ EventWidget.prototype.render = function(parent,nextSibling) {
$tw.utils.each(this.types,function(type) {
domNode.addEventListener(type,function(event) {
var selector = self.getAttribute("selector"),
matchSelector = self.getAttribute("matchSelector"),
actions = self.getAttribute("$"+type) || self.getAttribute("actions-"+type),
stopPropagation = self.getAttribute("stopPropagation","onaction"),
selectedNode = event.target,
@@ -56,27 +57,34 @@ EventWidget.prototype.render = function(parent,nextSibling) {
if(selectedNode.nodeType === 3) {
selectedNode = selectedNode.parentNode;
}
// Check that the selected node matches any matchSelector
if(matchSelector && !$tw.utils.domMatchesSelector(selectedNode,matchSelector)) {
return false;
}
if(selector) {
// Search ancestors for a node that matches the selector
while(!$tw.utils.domMatchesSelector(selectedNode,selector) && selectedNode !== domNode) {
selectedNode = selectedNode.parentNode;
}
// If we found one, copy the attributes as variables, otherwise exit
if($tw.utils.domMatchesSelector(selectedNode,selector)) {
// Only set up variables if we have actions to invoke
if(actions) {
$tw.utils.each(selectedNode.attributes,function(attribute) {
variables["dom-" + attribute.name] = attribute.value.toString();
});
//Add a variable with a popup coordinate string for the selected node
variables["tv-popup-coords"] = "(" + selectedNode.offsetLeft + "," + selectedNode.offsetTop +"," + selectedNode.offsetWidth + "," + selectedNode.offsetHeight + ")";
//Add variables for offset of selected node
variables["tv-selectednode-posx"] = selectedNode.offsetLeft.toString();
variables["tv-selectednode-posy"] = selectedNode.offsetTop.toString();
variables["tv-selectednode-width"] = selectedNode.offsetWidth.toString();
variables["tv-selectednode-height"] = selectedNode.offsetHeight.toString();
// Exit if we didn't find one
if(selectedNode === domNode) {
return false;
}
// Only set up variables if we have actions to invoke
if(actions) {
$tw.utils.each(selectedNode.attributes,function(attribute) {
variables["dom-" + attribute.name] = attribute.value.toString();
});
//Add a variable with a popup coordinate string for the selected node
variables["tv-popup-coords"] = "(" + selectedNode.offsetLeft + "," + selectedNode.offsetTop +"," + selectedNode.offsetWidth + "," + selectedNode.offsetHeight + ")";
//Add variables for offset of selected node
variables["tv-selectednode-posx"] = selectedNode.offsetLeft.toString();
variables["tv-selectednode-posy"] = selectedNode.offsetTop.toString();
variables["tv-selectednode-width"] = selectedNode.offsetWidth.toString();
variables["tv-selectednode-height"] = selectedNode.offsetHeight.toString();
if(event.clientX && event.clientY) {
//Add variables for event X and Y position relative to selected node
selectedNodeRect = selectedNode.getBoundingClientRect();
variables["event-fromselected-posx"] = (event.clientX - selectedNodeRect.left).toString();
@@ -86,9 +94,11 @@ EventWidget.prototype.render = function(parent,nextSibling) {
catcherNodeRect = self.domNode.getBoundingClientRect();
variables["event-fromcatcher-posx"] = (event.clientX - catcherNodeRect.left).toString();
variables["event-fromcatcher-posy"] = (event.clientY - catcherNodeRect.top).toString();
//Add variables for event X and Y position relative to the viewport
variables["event-fromviewport-posx"] = event.clientX.toString();
variables["event-fromviewport-posy"] = event.clientY.toString();
}
} else {
return false;
}
}
// Execute our actions with the variables

View File

@@ -111,6 +111,16 @@ ImageWidget.prototype.render = function(parent,nextSibling) {
if(this.imageAlt) {
domNode.setAttribute("alt",this.imageAlt);
}
// Add classes when the image loads or fails
$tw.utils.addClass(domNode,"tc-image-loading");
domNode.addEventListener("load",function() {
$tw.utils.removeClass(domNode,"tc-image-loading");
$tw.utils.addClass(domNode,"tc-image-loaded");
},false);
domNode.addEventListener("error",function() {
$tw.utils.removeClass(domNode,"tc-image-loading");
$tw.utils.addClass(domNode,"tc-image-error");
},false);
// Insert element
parent.insertBefore(domNode,nextSibling);
this.domNodes.push(domNode);

View File

@@ -46,7 +46,7 @@ ImportVariablesWidget.prototype.execute = function(tiddlerList) {
this.tiddlerList = tiddlerList || this.wiki.filterTiddlers(this.filter,this);
// Accumulate the <$set> widgets from each tiddler
$tw.utils.each(this.tiddlerList,function(title) {
var parser = widgetPointer.wiki.parseTiddler(title);
var parser = widgetPointer.wiki.parseTiddler(title,{parseAsInline:true});
if(parser) {
var parseTreeNode = parser.tree[0];
while(parseTreeNode && parseTreeNode.type === "set") {

View File

@@ -32,13 +32,7 @@ JSONTiddlerWidget.prototype.render = function(parent,nextSibling) {
this.computeAttributes();
this.execute();
// Collect the fields from the optional base tiddler
var fields = {};
if(this.attTiddler) {
var tiddler = this.wiki.getTiddler(this.attTiddler);
if(tiddler) {
fields = tiddler.getFieldStrings({exclude: this.attExclude.split(" ")});
}
}
var fields = this.getTiddlerFields();
// Add custom fields specified in attributes starting with $
$tw.utils.each(this.attributes,function(attribute,name) {
if(name.charAt(0) === "$") {
@@ -79,6 +73,19 @@ JSONTiddlerWidget.prototype.refresh = function(changedTiddlers) {
}
};
JSONTiddlerWidget.prototype.getTiddlerFields = function() {
var fields = {};
if(this.attTiddler) {
var tiddler = this.wiki.getTiddler(this.attTiddler);
if(tiddler) {
fields = tiddler.getFieldStrings({exclude: this.attExclude.split(" ")});
} else {
fields = {title: this.attTiddler};
}
}
return fields;
};
exports.jsontiddler = JSONTiddlerWidget;
})();

View File

@@ -0,0 +1,96 @@
/*\
title: $:/core/modules/widgets/let.js
type: application/javascript
module-type: widget
This widget allows defining multiple variables at once, while allowing
the later variables to depend upon the earlier ones.
```
\define helloworld() Hello world!
<$let currentTiddler="target" value={{!!value}} currentTiddler="different">
{{!!value}} will be different from <<value>>
</$let>
```
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var Widget = require("$:/core/modules/widgets/widget.js").widget;
var LetWidget = function(parseTreeNode,options) {
// Initialise
this.initialise(parseTreeNode,options);
};
/*
Inherit from the base widget class
*/
LetWidget.prototype = new Widget();
/*
Render this widget into the DOM
*/
LetWidget.prototype.render = function(parent,nextSibling) {
this.parentDomNode = parent;
this.computeAttributes();
this.execute();
this.renderChildren(parent,nextSibling);
};
LetWidget.prototype.computeAttributes = function() {
// Before computing attributes, we must make clear that none of the
// existing attributes are staged for lookup, even on a refresh
var changedAttributes = {},
self = this;
this.currentValueFor = Object.create(null);
$tw.utils.each(this.parseTreeNode.orderedAttributes,function(attribute,index) {
var value = self.computeAttribute(attribute),
name = attribute.name;
if(name.charAt(0) !== "$") {
// Now that it's prepped, we're allowed to look this variable up
// when defining later variables
self.currentValueFor[name] = value;
}
});
// Run through again, setting variables and looking for differences
$tw.utils.each(this.currentValueFor,function(value,name) {
if (self.attributes[name] !== value) {
self.attributes[name] = value;
self.setVariable(name,value);
changedAttributes[name] = true;
}
});
return changedAttributes;
};
LetWidget.prototype.getVariableInfo = function(name,options) {
// Special handling: If this variable exists in this very $let, we can
// use it, but only if it's been staged.
if ($tw.utils.hop(this.currentValueFor,name)) {
return {
text: this.currentValueFor[name]
};
}
return Widget.prototype.getVariableInfo.call(this,name,options);
};
/*
Refresh the widget by ensuring our attributes are up to date
*/
LetWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
if($tw.utils.count(changedAttributes) > 0) {
this.refreshSelf();
return true;
}
return this.refreshChildren(changedTiddlers);
};
exports["let"] = LetWidget;
})();

View File

@@ -207,7 +207,8 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
*/
LinkWidget.prototype.refresh = function(changedTiddlers) {
var changedAttributes = this.computeAttributes();
if(changedAttributes.to || changedTiddlers[this.to] || changedAttributes["aria-label"] || changedAttributes.tooltip) {
if(changedAttributes.to || changedTiddlers[this.to] || changedAttributes["aria-label"] || changedAttributes.tooltip ||
changedAttributes["class"] || changedAttributes.tabindex || changedAttributes.draggable || changedAttributes.tag) {
this.refreshSelf();
return true;
}

View File

@@ -51,6 +51,9 @@ ListWidget.prototype.render = function(parent,nextSibling) {
} else {
this.storyview = null;
}
if(this.storyview && this.storyview.renderEnd) {
this.storyview.renderEnd();
}
};
/*
@@ -236,6 +239,11 @@ ListWidget.prototype.handleListChanges = function(changedTiddlers) {
hasRefreshed = hasRefreshed || refreshed;
}
}
// If there are items to remove and we have not refreshed then recreate the item that will now be at the last position
if(!hasRefreshed && this.children.length > this.list.length) {
this.removeListItem(this.list.length-1);
this.insertListItem(this.list.length-1,this.list[this.list.length-1]);
}
} else {
// Cycle through the list, inserting and removing list items as needed
for(t=0; t<this.list.length; t++) {

View File

@@ -36,28 +36,38 @@ MessageCatcherWidget.prototype.render = function(parent,nextSibling) {
// Helper to add an event handler
var addEventHandler = function(type,actions) {
if(type && actions) {
var isActionStringExecuting = false;
self.addEventListener(
type,
function(event) {
// Don't trap the event if it came from one of our action handlers
if(isActionStringExecuting) {
return true;
}
// Collect all the event properties into variables
var collectProps = function(obj,prefix) {
prefix = prefix || "";
var props = {};
var props = {},
names = [];
$tw.utils.each(obj,function(value,name) {
if(["string","boolean","number"].indexOf(typeof value) !== -1) {
props[prefix + name] = value.toString();
names.push(name);
props[prefix + "-" + name] = value.toString();
}
});
props["list-" + prefix] = $tw.utils.stringifyList(names);
return props;
};
var variables = $tw.utils.extend(
{},
collectProps(event.paramObject,"event-paramObject-"),
collectProps(event,"event-"),
collectProps(event.paramObject,"event-paramObject"),
collectProps(event,"event"),
{
modifier: $tw.keyboardManager.getEventModifierKeyDescriptor(event)
});
isActionStringExecuting = true;
self.invokeActionString(actions,self,event,variables);
isActionStringExecuting = false;
return false;
}
);

View File

@@ -44,8 +44,7 @@ NavigatorWidget.prototype.render = function(parent,nextSibling) {
{type: "tm-fold-tiddler", handler: "handleFoldTiddlerEvent"},
{type: "tm-fold-other-tiddlers", handler: "handleFoldOtherTiddlersEvent"},
{type: "tm-fold-all-tiddlers", handler: "handleFoldAllTiddlersEvent"},
{type: "tm-unfold-all-tiddlers", handler: "handleUnfoldAllTiddlersEvent"},
{type: "tm-rename-tiddler", handler: "handleRenameTiddlerEvent"}
{type: "tm-unfold-all-tiddlers", handler: "handleUnfoldAllTiddlersEvent"}
]);
this.parentDomNode = parent;
this.computeAttributes();
@@ -499,11 +498,7 @@ NavigatorWidget.prototype.handleNewTiddlerEvent = function(event) {
// Import JSON tiddlers into a pending import tiddler
NavigatorWidget.prototype.handleImportTiddlersEvent = function(event) {
// Get the tiddlers
var tiddlers = [];
try {
tiddlers = JSON.parse(event.param);
} catch(e) {
}
var tiddlers = $tw.utils.parseJSONSafe(event.param,[]);
// Get the current $:/Import tiddler
var importTitle = event.importTitle ? event.importTitle : IMPORT_TITLE,
importTiddler = this.wiki.getTiddler(importTitle),
@@ -636,16 +631,6 @@ NavigatorWidget.prototype.handleUnfoldAllTiddlersEvent = function(event) {
});
};
NavigatorWidget.prototype.handleRenameTiddlerEvent = function(event) {
var options = {},
paramObject = event.paramObject || {},
from = paramObject.from || event.tiddlerTitle,
to = paramObject.to;
options.dontRenameInTags = (paramObject.renameInTags === "false" || paramObject.renameInTags === "no") ? true : false;
options.dontRenameInLists = (paramObject.renameInLists === "false" || paramObject.renameInLists === "no") ? true : false;
this.wiki.renameTiddler(from,to,options);
};
exports.navigator = NavigatorWidget;
})();

Some files were not shown because too many files have changed in this diff Show More