1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-08-05 02:30:35 +00:00
Commit Graph

221 Commits

Author SHA1 Message Date
Jermolene
e14e69bedc DynaView plugin: add optional scroll position preservation 2019-01-11 17:50:52 +00:00
BurningTreeC
0396af849a Undo #3490 - error in popup-cancelling logic (#3586) 2018-11-29 09:49:11 +00:00
Rob Hoelz
09ea59240a Cancel non-ancestor popups when showing a new popup (#3490)
Addresses GH #3484

As far as I can tell, the popup level checks in this module are
meant to handle nested popups.  It seems to me that the goal is
for at most a single hierarchy of popups to exist at any given time
- bearing that in mind, this change checks any popups currently tracked
by the module, canceling any that don't share an element hierarchy with
the new popup.
2018-11-25 10:42:21 +00:00
BurningTreeC
2541b9b090 Pagescroller - get scroll pos in src window (#3561) 2018-11-21 11:32:22 +00:00
BurningTreeC
33ba69e852 Modals: Display in source-window (#3539)
* Make modals display in source Window

this makes modals display within the window where they got opened, with the parameter `rootwindow` that, if `yes` or `true`, shows the modal always in the root TW window (`<$action-sendmessage $message="tm-modal" $param="mymodal" rootwindow="yes|true"/>`)

* pass the full event to $tw.modal.display

we need the event there to find `srcDocument` and `srcWindow`

* pass event in options object

* update modal.js to use options.event

* add docs for rootwindow tm-modal attribute
2018-11-18 20:57:04 +00:00
BurningTreeC
849844be12 Add stateTitle stateField stateIndex attributes (#3529)
* make triggerPopup optionally set state directly

* update button widget for new state attributes

* update reveal widget for new state attributes

* fix errors in button widget
2018-11-18 19:16:46 +00:00
BurningTreeC
0ff96f9caf [pagescroller] add callback function option (#3473)
this allows using the pagescroller for scrolling elements into view where the rect gets calculated somewhere else

Example: CodeMirror has the `cm.cursorCoords()` function that returns the rect of the textselection (or cursor coordinates)

this scrolls the cursor or text selection into view using tiddlywikis pagescroller:

`$tw.pageScroller.scrollIntoView(undefined, function() { return self.cm.cursorCoords(true,"window"); });`
2018-11-15 14:58:32 +00:00
BurningTreeC
55b5b6dd56 PageScroller: scroll in new windows (#3537)
* make pageScroller work in new windows

* update getScrollPosition to work for new windows

* Update dom.js
2018-11-13 18:07:55 +00:00
BurningTreeC
4d1127ed5b Fix tc-adjust-top-of-scroll (#3475)
* correct scrolling with tc-adjust-top-of-scroll

not multiplying `offset` with t causes jumps at the first animation steps, where the offset value is bigger than `endY - scrollPosition.y`

* correct scroll offset
2018-11-06 16:23:46 +00:00
BurningTreeC
5dcdff4b37 Fix scrolling with tc-adjust-top-of-scroll (#3467)
not multiplying `offset` with t causes jumps at the first animation steps, where the offset value is bigger than `endY - scrollPosition.y`
2018-10-07 10:23:41 +01:00
Jermolene
f98b4d5956 Add more logging for drop operations 2018-09-13 20:42:35 +01:00
Jermolene
7a6213dcbf Update code comment for $tw.utils.http 2018-08-23 13:13:49 +01:00
Jermolene
5a2e87eb09 Extend permalink/permaview to optionally copy URL to the clipboard
Fixes #3255
2018-08-16 19:39:18 +01:00
Jermolene
b55a3102be Fix typo from 8a38685 2018-08-16 16:08:33 +01:00
Jermolene
8a38685de9 Optionally adjust scroll targets to allow for a top menu bar
Fixes #3396
2018-08-16 12:07:50 +01:00
Jermolene
7b9dc7557c Popup manager enhancements 2018-08-09 19:39:58 +01:00
snlhnk
c05c0d3df6 Module-ize server routes, add static file support and other enhancements(#2679)
* Module-ize server routes and add static file support (#2510)

* Refactor server routes to modules

New module type: serverroute

Caveats: Loading order is not deterministic but this would only matter
if two route modules attempted to use the same path regexp (that would
be silly).

* Add static assets plugin

This plugin allows the node server to fetch static assets in the /assets
directory. I felt that this was a feature that goes above the core
functionality. That is why I added it as a plugin. with the modular
route extensions this was a breeze.

* Add serverroute description to ModuleTypes

* Coding standards tweaks

* Fix filename typo

* Move support for attachments from a plugin into the core

* Missing "else"

* Refactor server handling

* Introduce a new named parameter scheme for commands
* Move the SimpleServer class into it's own module
* Deprecate the --server command because of the unwieldy syntax
* Add a new --listen command using the new syntax

For example:

tiddlywiki mywiki --listen host:0.0.0.0 port:8090

* Add check for unknown parameters

* Add support for multiple basic authentication credentials in a CSV file

Beware: Passwords are stored in plain text. If that's a problem, use an authenticating proxy and the trusted header authentication approach.

* Refactor module locations

* Rename "serverroute" module type to "route"

* Remove support for verifying optional named command parameters

The idea was to be able to flag unknown parameter names, but requiring a command to pre-specify all the parameter names makes it harder for (say) the listen command to be extensible so that plugins can add new optional parameters that they handle. (This is particularly in the context of work in progress to encapsulate authenticators into their own modules).

* Refactor the two authenticators into separate modules and add support for authorization

* Correct mistaken path.join vs. path.resolve

See https://stackoverflow.com/a/39836259

* Docs for the named command parameters

I'd be grateful if anyone with sufficient Windows experience could confirm that the note about double quotes in "NamedCommandParameters" is correct.

* Be consistent about lower case parameter names

* Do the right thing when we have a username but no password

With a username parameter but no password parameter we'll attribute edits to that username, but not require authentication.

* Remove obsolete code

* Add support for requiring authentication without restricting the username

* Refactor authorization checks

* Return read_only status in /status response

* Fix two code typos

* Add basic support for detecting readonly status and avoiding write errors

We now have syncadaptors returning  readonly status and avoid attempting to write to the server if it's going to fail

* Add readonly-styles

We hide editing-related buttons in read only mode

I've made this part of the tiddlyweb plugin but I think a case could be made for putting it into the core.

* Add custom request header as CSRF mitigation

By default we require the header X-Requested-With to be set to TiddlyWiki. Can be overriden by setting csrfdisable to "yes"

See https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet#Protecting_REST_Services:_Use_of_Custom_Request_Headers

* Add support for HTTPS

* First pass at a route for serving rendered tiddlers

cc @Drakor

* Tweaks to the single tiddler static view

Adding a simple sidebar

* Switch to "dash" separated parameter names

* Typo

* Docs: Update ServerCommand and ListenCommand

* First pass at docs for the new web server stuff

Writing the docs is turning out to be quite an undertaking, much harder than writing the code!

* Get rid of extraneous paragraphs in static renderings

* Rejig anonymous user handling

Now we can support wikis that are read-only for anonymous access, but allow a user to login for read/write access.

* More docs

Slowly getting there...

* Static tiddler rendering: Fix HTML content in page title

* Docs updates

* Fix server command parameter names

Missed off 30ce7ea

* Docs: Missing quotes

* Avoid inadvertent dependency on Node.js > v9.6.0

The listenOptions parameter of the plain HTTP version of CreateServer was only introduced in v9.6.0

cc @Drakor @pmario

* Typo
2018-07-18 16:54:43 +01:00
BurningTreeC
afe14b47b5 draggable widget: actions on drag-start and drag-end (#3203)
* pass drag-start end drag-end actions to draggable

* Update dragndrop.js

* Update dragndrop.js

* Update dragndrop.js

* Update dragndrop.js

* Update dragndrop.js

* renaming dragstart/dragend -> start/end

* renaming dragstart/dragend -> start/end

* adding docs
2018-04-08 10:29:17 +01:00
Jermolene
1c8170463c Simplify page scrolling behaviour
Fixes #2180
2018-01-30 11:29:07 +00:00
Jermolene
327fed30c8 Mitigate problem with microscropic editor in zoomin view
See #3098
2018-01-23 16:22:35 +00:00
BurningTreeC
42660b05a7 check if dataTransfer is undefined (#3093)
this prevents an error when dragging elements not by mouse where dataTransfer can be undefined
2018-01-20 17:28:10 +00:00
Jermolene
ca43a28d0e Fix copy to clipboard for iOS 10/11 2017-12-17 21:37:29 +00:00
Jermolene
d2ff164c07 Add support for tm-copy-to-clipboard message 2017-12-15 15:08:18 +00:00
Jermolene
1e106a8f3d Better handling of dropeffect 2017-03-28 15:09:36 +01:00
Jermolene
f3cab3753e Don't set draggable property for links 2017-03-28 13:05:00 +01:00
Jermolene
d3fe4f600a Partially fix drag and drop on IE11
These changes allow drag and drop to work with one issue: <a> links are
not draggable; draggable divs, spans, buttons etc. seem to work fine.
There’s some issue with IE11 that I don’t understand.

For testing, you can force links to become spans by changing line 64 of
$:/core/modules/widgets/link.js to:

	var domNode = this.document.createElement("span");
2017-03-27 09:59:40 +01:00
Jermolene
1f860bd04e Fix problem with dragging links 2017-03-23 17:52:15 +00:00
Jermolene
b1ed77d6b8 Switch drag image to use draggable DOM node
We’ll still support dragging pills, but dragging the DOM node image
seems to look better in most situations.
2017-03-23 17:02:26 +00:00
Jermolene
8f1114960a Refactor draggable stuff for easier reuse
And in the process, make the button widget draggable.

Unfortunately, Firefox has a bug that prevents buttons from being
dragged (see https://bugzilla.mozilla.org/show_bug.cgi?id=568313 and
https://bugzilla.mozilla.org/show_bug.cgi?id=646823). So we have to use
the “tag” attribute to make it use a different element.
2017-03-23 14:23:33 +00:00
Jermolene
bea33efd63 Fix problem with dragging text snippets 2017-03-20 22:03:28 +00:00
Jermolene
eba1c3c160 Improve support for drag and drop
Documentation TBD
2017-03-19 19:33:56 +00:00
Jermolene
73e1724fdf Extend $tw.utils.httpRequest() to cope with binary data
The problem was that `this.responseText` crashes for non-text data. We
fix it by letting the client specify which property should be returned.

@ericshulman does this work for you?
2017-03-17 13:41:17 +00:00
Jermolene
8e02bde938 Refinements to 87fa7f972c 2016-10-18 16:39:18 +01:00
Jermolene
f846a004b6 Partial fix for copyStyles problem under Chrome
There’s still a problem: in Chrome, the styling of the textarea
placeholder isn’t correct.
2016-05-17 15:45:10 -06:00
Myeongjin
6388f859d1 Add localisable strings for error (#2447)
* Add localisable strings for error

* Update tiddler Transclusion Basic Usage in fr-FR
2016-05-17 21:58:47 +01:00
Myeongjin
8afc1e9354 Add localisable strings (#2438)
* Add localisable string for recursive transclusion error

* Add localisable string for count

* Add localisable strings for syncer
2016-05-12 08:44:28 -06:00
Jermolene
e54cc7b211 Fix copyStyles() not working in Firefox
Yet more browser incompatibilities to weep over…
2016-05-09 14:11:08 -06:00
Jermolene
3a3754aebb Add rel="noopener noreferrer" to external links
Background:
https://medium.com/@jitbit/target-blank-the-most-underestimated-vulnerab
ility-ever-96e328301f4c#.hduwdbjlb
2016-05-05 11:49:40 +01:00
Jeremy Ruston
2adf09129d Introduce text editor toolbar (#2315)
Tada!
2016-04-22 08:36:29 +01:00
Myeongjin
e6e346ea29 change string 'Close' to lowercase for dialog (#2366) 2016-04-14 23:03:14 +01:00
Myeongjin
c9b0e15201 add localisable strings for dialog 2016-03-28 16:24:55 +09:00
Jermolene
5cc1f2b313 Fix problem with search popup disappearing
This one took quite a lot of tracking down…

Fixes #2172
2016-01-03 18:05:08 +00:00
Jermolene
a204784c0c Limited implementation of external text tiddlers in the browser
Triggered by the discussion in #1917
2015-08-29 16:33:04 +01:00
Jermolene
86e901f375 Fix event handler leak for modals and notifications
Also add support for passing custom variables into notifications.

Fixes #1694
2015-05-06 08:07:12 +01:00
Jermolene
b7465c5eb1 Missed off 7c9976f1d9 2015-04-02 15:22:50 +01:00
Jermolene
7c9976f1d9 Partially revert to 5.1.7 scroll behaviour
We’re keeping the new logic that prevents unnecessary scrolling at
startup

Fixes #1543
2015-04-02 15:21:49 +01:00
Jermolene
421ac16389 Use inline parsing for header and footer of modals
This may cause backwards compatibility problems for people relying on
the block mode parsing, but it’s much better for the rest of us as it
avoids an unsightly paragraph tag
2015-03-18 11:41:10 +00:00
Jermolene
65d81921f9 Further fixes to scrolling behaviour 2015-02-25 20:24:07 +00:00
Jermolene
8d46c18fc7 Refine fix for #1526
The previous fix changed the scrolling behaviour such that it only
scrolled to the top of a tiddler if the tiddler was entirely offscreen.
It wasn’t entirely satisfactory because scrolling was prevented even if
only a few pixels of a tiddler are in view. This commit ensures that
the scroll does occur if less than 50 pixels of the target is in view
2015-02-25 19:09:53 +00:00
Jermolene
489bc7a50b Only scroll to top when tiddlers are completely off-screen
Fixes #1526
2015-02-25 19:01:40 +00:00
Jermolene
3df341621d Alternative fix for unnecessary startup scrolling
@aelocson here’s an alternative fix for #981, as discussed in
https://github.com/Jermolene/TiddlyWiki5/commit/691e5719a4ff74a04d389bd1
26ba2a69e7651a2a#commitcomment-9848682

It does seem a lot nicer. It avoids the problem you raised, and also
avoids scrolling when a permalink is used.

I suspect that we’d need to make the hard-coded 50 pixels be
configurable.
2015-02-20 20:04:18 +00:00
Felix Küppers
3b2882cb48 Update browser.js 2015-01-08 20:18:41 +01:00
Jermolene
755693766a Removing debugging statements from popup mechanism 2014-12-10 17:09:14 +00:00
Jermolene
d6c5e51501 Fix popup handling in Cecily and Zoomin view
Cecily and Zoomin story views use a document.body that is smaller than
the document.documentElement. We were just clearing the popups on
clicks on the document.body Clicks on the document element (ie, on the
background of the page) were not being trapped, meaning that you
couldn’t dismiss a popup.
2014-11-22 10:19:03 +00:00
Jermolene
b882a0dff1 Fixes to make nested popups work
Thus making the export button a lot more useful
2014-11-21 17:07:03 +00:00
Jermolene
91a7c39791 Update modal handling to allow variables to be passed
@felixhayashi I’m afraid I haven’t used your pull request as there were
a few details that I wanted to do differently. The main change is that
these changes allow both a param string and hashmap to be specified.
2014-11-07 14:54:46 +00:00
Jermolene
0bb8e08edc Provisionally make tag pill foreground colour be responsive
With this commit tag pills will now choose for the foreground colour
either the current palette “foreground” or “background” colours,
according to which has the higher contrast. It’s something @gernert has
expressed an interest in in the past, and I’ve tended to agree that it
is a nice piece of polish. It opens up the possibility of paler colours
for tag pills than are currently possible.

The trouble is that in order to implement it I’ve had to bring in a
third party library for parsing CSS colours. It weighs in just over
9KB, making quite a lot of weight for such a small feature. I don’t see
any other immediate uses for the colour parsing library either.

So, I’m undecided at the moment whether this should stay in the core.
2014-11-06 13:35:48 +00:00
Jermolene
e2046ce4ff Treat HTTP 201 response code as success 2014-09-24 16:19:23 +02:00
Jermolene
f87ce7e98a Fix tiddler keyboard shortcuts
Maddeningly, I broke them in 5.0.16-beta…
2014-09-02 22:09:28 +01:00
Jermolene
b25351e834 Extend keyboard handling
To cope with the Mac’s “meta” key (ie command/⌘) preparatory to
trapping command-S
2014-09-02 10:41:48 +01:00
Jermolene
3a67fdb768 Obeisance to JSHint for core modules
There are still some warnings about making functions in a loop, but
I’ll fix those as a separate pull request because the fixes are more
than typographic errors.
2014-08-30 20:44:26 +01:00
Jermolene
2f69ea362c Rename "tw-*" messages to "tm-*" 2014-08-28 21:43:44 +01:00
Jermolene
f223310d34 Yet more "tw-*" -> "tc-*"
Part of #764
2014-08-28 19:41:29 +01:00
Jermolene
787481a804 Change more "tw-*" classes to "tc-*"
Part of #764
2014-08-28 18:21:08 +01:00
Jermolene
54591100b5 Rename "modal-*" classes to "tc-modal-*"
Part of #764
2014-08-28 17:34:02 +01:00
Jermolene
d8c3691bd1 Removed unneeded CSS classes
Part of #764
2014-08-28 17:17:50 +01:00
Jermolene
3529625a6c Fix full screen button not supported 2014-08-03 12:35:53 +01:00
Jermolene
799a5b059a Move fullscreen button into core from plugin 2014-08-01 16:52:12 +01:00
Jermolene
5f018c2092 More defensive dom utility hasClass()
It was failing on SVG elements such as `<path>`
2014-07-28 14:19:52 +01:00
Jermolene
3351ae7e29 Fix issue with localStorage error on Firefox
Firefox raises an error if window.localStorage is accessed when cookies
are disabled:

https://bugzilla.mozilla.org/show_bug.cgi?id=771890
2014-07-06 10:11:21 +01:00
Jermolene
465f4ac469 Fix problem with refreshing modal dialogues
Previously any refreshing of the content of a modal would cause a
crash. The problem is the way that we steal the root widget for the
render trees used in the modal. The root widget is tied to the
container DOM node for the main content area, which isn’t actually a
parent of the modal DOM nodes, hence the confusion for the refresh
mechanism.
2014-07-04 21:07:35 +01:00
Jermolene
7c8c5cf745 Fix problem with parsing main UI boot tiddlers
We were parsing the boot tiddlers, making them into a widget and then
refreshing the widget tree. The problem is that subsequent chances to
the boot tiddlers themselves wouldn’t be picked up as part of the
refresh.

Now we indirectly parse those UI boot tiddlers through a transclusion,
which does get refreshed in the desired way.
2014-05-06 10:14:22 +01:00
Jermolene
3cce12e13f More refactoring of startup.js 2014-05-05 14:41:46 +01:00
Jermolene
749582ede0 Split module loading into a separate startup task
Still a work in progress.
2014-05-03 17:10:55 +01:00
Jermolene
e366aa3746 Use Date.now() instead of new Date()
Just for when what we actually want is a millisecond counter.

Interesting video about this:

https://www.youtube.com/watch?v=Vo72W1HWeFI
2014-04-14 09:02:52 +01:00
Jermolene
535837e017 Use client bounding rect rather than offset positions for computing scroll positions 2014-03-24 22:31:03 +00:00
Jermolene
70a120d4a6 Expand the logging mechanism to support alerts overlaid on the main screen
Now we get decent visual indication of sync errors, for instance. Still
work to do to coalesce alerts so that the screen doesn’t fill up with
them after an interval. And probably we should add a button to clear
all alerts.
2014-02-14 07:53:41 +00:00
Jermolene
b26a32b93a Remove obsolete stylesheet helper 2014-02-08 09:29:11 +00:00
Jermolene
4882f70557 Clearer explanation of key descriptor syntax 2014-02-04 20:05:34 +00:00
Jermolene
e3a05625b2 Add experimental keyboard shortcut widget
It’s not cool that we have to use a separate keyboard widget for each
keyboard shortcut.

Fixes #386
2014-01-30 13:40:36 +00:00
Jermolene
b64b7982af Fix notification removal to not rely on transitionEnd events 2014-01-09 22:26:21 +00:00
Jermolene
e0f428b9b2 Fixed problem with Element.ELEMENT_NODE undefined on Safari 2014-01-04 15:15:12 +00:00
Jermolene
027421f5e6 More coding style consistency 2014-01-03 10:54:00 +00:00
Jermolene
b132e1023d Add error checking to $tw.utils.setStyle() 2014-01-02 19:00:46 +00:00
David Jade
7f5a8fc937 Better drag/drop for Firefox/Chrome and improved IE support 2013-12-20 19:57:05 -08:00
Jermolene
1c529ddcd4 Refactored stylesheet implementation
This way we reuse the refresh mechanism properly so that theme tweaks
can be applied interactively.
2013-12-20 15:31:16 +00:00
Jermolene
638c8b2070 Fixes to fullscreen support
Prompted by this article:

http://generatedcontent.org/post/70347573294/is-your-fullscreen-api-code
-up-to-date-find-out-how-to
2013-12-18 21:39:59 +00:00
Jermolene
06a66cf24e Improve popup dismissal
Now we ignore clicks if they come from an element that has an ancestor
with the class `tw-popup`
2013-11-12 22:02:26 +00:00
Jermolene
145e3ece78 Fix $tw.utils.hasClass() to work even if the element doesn't have a className property 2013-11-12 22:01:31 +00:00
Jeremy Ruston
cc0011abd3 Get rid of the "new_" prefix we had on some methods
There's still the "old_" prefix to get rid of too.
2013-11-08 08:51:14 +00:00
Jeremy Ruston
b7cb1d3391 Change new_widget to widget
I was avoiding doing this until after the merge.
2013-11-08 08:47:00 +00:00
Jeremy Ruston
31ae8910c6 Fix animation behaviour of reveal widget 2013-11-02 09:21:11 +00:00
Jeremy Ruston
6a6f6c7713 Restored animations for the reveal widget 2013-11-01 17:23:08 +00:00
Jeremy Ruston
05e73ee1da Cope with localStorage not being available
IE10 doesn't allow localStorage for HTML pages loaded from the file://
protocol.
Boo.
2013-10-29 22:21:25 +00:00
Jeremy Ruston
654f48b14d Fix problem with modal titles 2013-10-29 15:01:36 +00:00
Jeremy Ruston
14d7d5ea59 Use the new wiki.makeWidget() method where we can 2013-10-29 14:51:35 +00:00
Jeremy Ruston
f2ac04943f Fixed tag autocomplete popup on focus 2013-10-23 17:41:12 +01:00
Jeremy Ruston
2a571b4f5f Switch the notifier and modal mechanisms to use the new widget mechanism
Note the use of the `$tw.rootWidget` to collect together the root event
handlers
2013-10-21 20:14:01 +01:00
Jeremy Ruston
ce1fb300f8 Use the new widget mechanism for stylesheet parsing and rendering 2013-10-21 18:38:20 +01:00
Jeremy Ruston
94c2eacdc9 Support selectedClass properly in the button widget 2013-10-14 16:56:13 +01:00