1
0
mirror of https://github.com/flarum/core.git synced 2025-07-19 07:41:22 +02:00
Commit Graph

1095 Commits

Author SHA1 Message Date
Alexander Skvortsov
5127e7d063 Ensure that readyCallback is called on modals opened from other modals 2020-09-29 18:37:56 -04:00
Alexander Skvortsov
822ace668a Prevent hide animation when opening modal from other modal 2020-09-29 18:37:56 -04:00
Alexander Skvortsov
b4f563c38f Revert "Fix opening modals from other modals. (#2263)"
This reverts commit 1d7002a63f.
2020-09-29 18:37:56 -04:00
Alexander Skvortsov
36faf92864 Merge pull request #2299 from flarum/as/poststream_improvements
[Frontend Rewrite] PostStream Improvements
2020-09-29 18:34:16 -04:00
flarum-bot
9869ee0980 Bundled output for commit fc15249e5c [skip ci] 2020-09-29 20:56:44 +00:00
Wadim Kalmykov
fc15249e5c fix clear search (#2325) 2020-09-29 16:55:26 -04:00
flarum-bot
a8ea8b2931 Bundled output for commit 922cb8bb11 [skip ci] 2020-09-28 23:18:39 +00:00
Sami Mazouz
922cb8bb11 Fix mobile controls gesture on discussion deletion/restoration (#2324)
Because the Slidable class was always added on creation, it was lost every time the class list changed (in this case when the discussion was hidden/unhidden which added/removed DiscussionListItem--hidden class). So by determining the Slidable class's presence in elementAttrs() method, it guarantees it always properly set.
2020-09-28 19:07:05 -04:00
flarum-bot
1dfb01d067 Bundled output for commit 4b679a35e0 [skip ci] 2020-09-28 03:51:00 +00:00
Alexander Skvortsov
4b679a35e0 Put m.stream in flarum/utils/stream (#2316) 2020-09-27 23:49:33 -04:00
flarum-bot
ce9093ab5d Bundled output for commit bfa62dbe8f [skip ci] 2020-09-27 02:14:07 +00:00
Alexander Skvortsov
bfa62dbe8f Add warnings to Mithril 2 BC layer (#2313) 2020-09-26 22:12:43 -04:00
Alexander Skvortsov
98c684c979 Fixed noAnimation: previously, the opposite of what was requested happened 2020-09-25 16:02:39 -04:00
Alexander Skvortsov
2d7f8130c8 DiscussionPage: only set this.discussion after the initial set of posts has loaded, this results in a slightly smoother initial load. 2020-09-25 15:54:54 -04:00
Alexander Skvortsov
71518112b3 Provide location data to scrubber earlier to avoid unnecessary and confusing scrubber animation on page load. 2020-09-25 15:52:18 -04:00
Alexander Skvortsov
63d0730784 Don't animate the initial Scrubber placement 2020-09-25 15:43:41 -04:00
flarum-bot
c40a0e38d9 Bundled output for commit 8832ea0666 [skip ci] 2020-09-25 02:32:11 +00:00
Alexander Skvortsov
8832ea0666 Add in BC layer for props, initProps, m.withAttr, and m.prop (#2310) 2020-09-24 22:30:55 -04:00
flarum-bot
abcf55152f Bundled output for commit 077c28dc64 [skip ci] 2020-09-24 04:09:18 +00:00
Matteo Contrini
077c28dc64 Fix comment for the time gap feature in PostStream (#2294)
The time interval for the time gap feature is 4 days and not 4 hours.
2020-09-24 00:08:12 -04:00
flarum-bot
3012ec8da1 Bundled output for commit 1d7002a63f [skip ci] 2020-09-24 03:13:43 +00:00
Alexander Skvortsov
1d7002a63f Fix opening modals from other modals. (#2263)
While seemingly correct, an onremove method in Modal that triggers animateHide is problematic, because if one modal is opened from another, the one currently open will be removed from the DOM, triggering animateHide, and closing the new modal.

To compensate, an onupdate method now closes a modal if one is open but shouldn't be; this supports the functionality of the old method when the modal is closed not from the modal instance itself (e.g. app.modal.close())

This is not ideal, but necessary. We should consider eventually expanding the modal system to support showing multiple modals at the same time (stacked over each other). Then, we can move this back to individual modals.
2020-09-23 23:12:22 -04:00
Alexander Skvortsov
d57a9f100a Only call updateScrubberValues onupdate when necessary
When the page is scrolled, goToIndex is called, or the page is loaded,
various listeners result in the scrubber being updated with a new
position and values. However, if goToNumber is called, the scrubber
will not be updated. Accordingly, we add logic to the scrubber's
onupdate to update itself, but only when needed, as indicated by this

This saves us a LOT of unnecessary calls, and makes scrubber movement smoother.
2020-09-23 23:06:25 -04:00
Alexander Skvortsov
8640ce83b5 Execute oncreate scrubber update after loadPromise has completed
This way, we ensure that the initial position (and data) of the scrubber is correct. Otherwise, we get blank dates / incorrect location.
2020-09-23 23:06:20 -04:00
Alexander Skvortsov
a17f1247a8 Fix $(...).offset() is undefined on some scrolls. 2020-09-23 23:06:14 -04:00
flarum-bot
75d80b1c8a Bundled output for commit 8d21f6f074 [skip ci] 2020-09-24 03:06:06 +00:00
Alexander Skvortsov
8d21f6f074 Fix double fadein for post stream (#2300) 2020-09-23 23:04:56 -04:00
flarum-bot
83cfb331c2 Bundled output for commit 30cdf0acc0 [skip ci] 2020-09-24 02:41:41 +00:00
David Sevilla Martín
30cdf0acc0 Mithril 2 update (#2255)
* Update frontend to Mithril 2

- Update Mithril version to v2.0.4
- Add Typescript typings for Mithril
- Rename "props" to "attrs"; "initProps" to "initAttrs"; "m.prop" to "m.stream"; "m.withAttr" to "utils/withAttr".
- Use Mithril 2's new lifecycle hooks
- SubtreeRetainer has been rewritten to be more useful for the new system
- Utils for forcing page re-initializations have been added (force attr in links, setRouteWithForcedRefresh util)
- Other mechanical changes, following the upgrade guide
- Remove some of the custom stuff in our Component base class
- Introduce "fragments" for non-components that control their own DOM
- Remove Mithril patches, introduce a few new ones (route attrs in <a>; 
- Redesign AlertManagerState `show` with 3 overloads: `show(children)`, `show(attrs, children)`, `show(componentClass, attrs, children)`
- The `affixedSidebar` util has been replaced with an `AffixedSidebar` component

Challenges:
- `children` and `tag` are now reserved, and can not be used as attr names
- Behavior of links to current page changed in Mithril. If moving to a page that is handled by the same component, the page component WILL NOT be re-initialized by default. Additional code to keep track of the current url is needed (See IndexPage, DiscussionPage, and UserPage for examples)
- Native Promise rejections are shown on console when not handled
- Instances of components can no longer be stored. The state pattern should be used instead.

Refs #1821.

Co-authored-by: Alexander Skvortsov <sasha.skvortsov109@gmail.com>
Co-authored-by: Matthew Kilgore <tankerkiller125@gmail.com>
Co-authored-by: Franz Liedke <franz@develophp.org>
2020-09-23 22:40:37 -04:00
flarum-bot
39437ff1c9 Bundled output for commit e3b8b8dd46 [skip ci] 2020-09-18 19:33:18 +00:00
Alexander Skvortsov
e3b8b8dd46 Add missing exports to compat 2020-09-18 21:31:35 +02:00
flarum-bot
e59c3fa279 Bundled output for commit eb0d3de3f6 [skip ci] 2020-09-04 17:00:30 +00:00
Franz Liedke
eb0d3de3f6 app.composer.show: Trigger synchronous redraw
This is needed to have access to the newly created SuperTextarea
instance (app.composer.editor) directly after calling show().

Discovered when making ext-mentions work with the Composer state
changes. As far as I could reconstruct, a synchronous redraw was also
triggered in this situation before the changes in #2161.
2020-09-04 18:58:40 +02:00
flarum-bot
4f21e22236 Bundled output for commit f011974bf1 [skip ci] 2020-08-28 02:41:03 +00:00
fengkx
f011974bf1 fix: escape regexp from query (#2273)
* fix: escape regexp from query
2020-08-27 22:39:49 -04:00
flarum-bot
18bf17bb47 Bundled output for commit 933b25ee8e [skip ci] 2020-08-25 14:54:57 +00:00
Karan Sanjeev
933b25ee8e Added an empty alt attribute to avatar's img tag (#2269)
fixes #2256
2020-08-25 10:53:44 -04:00
flarum-bot
f6f92f9713 Bundled output for commit e0bc3e9ce4 [skip ci] 2020-08-16 20:36:13 +00:00
Matteo Contrini
e0bc3e9ce4 Fix number abbreviation when the number is n-thousand (#2261)
This commit fixes the method `abbreviateNumber` so that it behaves as stated in the JSDoc.

Previously, an input of `1234` would have produced `1K`. With this change, the output will be `1.2K`.
2020-08-16 16:35:05 -04:00
flarum-bot
37ae209ba6 Bundled output for commit 22e813c742 [skip ci] 2020-08-16 20:34:13 +00:00
Franz Liedke
22e813c742 Extract a few changes from the Mithril 2 upgrade (#2262)
* Fix closing the composer with ESC key

Regression from #2161.

* Remove obsolete method

Regression from #2162.

* Mark method as protected

* Fade in posts in post stream using CSS

This also avoids a double-fade from the JavaScript code, which was
probably introduced in #2160.

* Fix fadeIn for post stream items

Co-authored-by: Alexander Skvortsov <sasha.skvortsov109@gmail.com>
2020-08-16 16:32:59 -04:00
flarum-bot
2790a34cf2 Bundled output for commit 81e6964053 [skip ci] 2020-08-08 18:47:16 +00:00
Alexander Skvortsov
81e6964053 Extract PostStream state (#2160)
Co-authored-by: Franz Liedke <franz@develophp.org>
2020-08-08 14:45:54 -04:00
dependabot[bot]
695e7bb766 Bump elliptic from 6.5.2 to 6.5.3 in /js (#2251)
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.2...v6.5.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-31 01:08:39 +02:00
flarum-bot
cb95c136df Bundled output for commit ba0e2db8a7 [skip ci] 2020-07-24 22:18:35 +00:00
Alexander Skvortsov
ba0e2db8a7 Extract Composer state (#2161)
Like previous "state PRs", this moves app-wide logic relating to
our "composer" widget to its own "state" class, which can be
referenced and called from all parts of the app. This lets us
avoid storing component instances, which we cannot do any longer
once we update to Mithril v2.

This was not as trivial as some of the other state changes, as we
tried to separate DOM effects (e.g. animations) from actual state
changes (e.g. minimizing or opening the composer).

New features:

- A new `app.screen()` method returns the current responsive screen
  mode. This lets us check what breakpoint we're on in JS land  
  without hardcoding / duplicating the actual breakpoints from CSS.
- A new `SuperTextarea` util exposes useful methods for directly
  interacting with and manipulating the text contents of e.g. our
  post editor.
- A new `ConfirmDocumentUnload` wrapper component encapsulates the
  logic for asking the user for confirmation when trying to close
  the browser window or navigating to another page. This is used in
  the composer to prevent accidentally losing unsaved post content.

There is still potential for future cleanups, but we finally want   
to unblock the Mithril update, so these will have to wait:

- Composer height change logic is very DOM-based, so should maybe
  not sit in the state.
- I would love to experiment with using composition rather than
  inheritance for the `ComposerBody` subclasses.
2020-07-25 00:17:25 +02:00
flarum-bot
0dde2dcc9f Bundled output for commit 6480c6f937 [skip ci] 2020-07-24 21:53:31 +00:00
Franz Liedke
6480c6f937 Fix an irrelevant export name :P 2020-07-24 23:51:44 +02:00
flarum-bot
5df2f11ace Bundled output for commit 5a60d9d7a1 [skip ci] 2020-07-24 17:03:04 +00:00
Alexander Skvortsov
5a60d9d7a1 Notifications Dropdown: Remove init method that doesn't do anything (cleanup) 2020-07-24 13:01:45 -04:00