2013-02-06 03:16:51 +08:00
|
|
|
// --------------------------------------------------
|
|
|
|
// Mixins used throughout the theme
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
|
|
|
// Media queries
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
2023-02-07 23:24:57 +08:00
|
|
|
@use "sass:math";
|
|
|
|
|
2018-07-13 04:38:51 +08:00
|
|
|
$breakpoints: (
|
|
|
|
mobile-small: 320px,
|
2019-04-10 01:15:31 +08:00
|
|
|
mobile-medium: 350px,
|
2019-07-11 21:57:53 +08:00
|
|
|
mobile-large: 450px,
|
|
|
|
mobile-extra-large: 550px,
|
2018-07-13 04:38:51 +08:00
|
|
|
tablet: 768px,
|
|
|
|
medium: 850px,
|
|
|
|
large: 1000px,
|
|
|
|
extra-large: 1140px,
|
|
|
|
);
|
|
|
|
|
2022-07-20 10:56:41 +08:00
|
|
|
@mixin breakpoint($bp, $rule: max-width, $type: screen, $sidebar: false) {
|
2023-07-06 00:20:18 +08:00
|
|
|
$bp-value: map-get($breakpoints, $bp);
|
|
|
|
|
|
|
|
@if $rule == min-width {
|
|
|
|
$bp-value: calc(#{$bp-value} + 1px);
|
|
|
|
}
|
|
|
|
|
|
|
|
@media #{$type} and (#{$rule}: #{$bp-value}) {
|
2018-07-13 04:41:44 +08:00
|
|
|
@content;
|
2018-06-08 17:49:31 +08:00
|
|
|
}
|
2022-07-20 10:56:41 +08:00
|
|
|
|
|
|
|
// if you want to consider the sidebar in your breakpoint
|
|
|
|
// you can pass in $sidebar: true
|
|
|
|
// note that your breakpoint will need to be at the root level
|
|
|
|
@if $sidebar {
|
|
|
|
// when the sidebar is shown, we want to increase the breakpoints by the width of the sidebar
|
|
|
|
@media #{$type} and (#{$rule}: calc(#{map-get($breakpoints, $bp)} + #{$d-sidebar-width})) {
|
|
|
|
.has-sidebar-page {
|
|
|
|
@content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-06-08 17:49:31 +08:00
|
|
|
}
|
2013-12-19 00:50:51 +08:00
|
|
|
|
2013-02-06 03:16:51 +08:00
|
|
|
// CSS3 properties
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
2015-03-23 22:23:42 +08:00
|
|
|
// Clearfix
|
|
|
|
|
|
|
|
@mixin clearfix() {
|
2018-06-08 17:49:31 +08:00
|
|
|
&:before,
|
|
|
|
&:after {
|
|
|
|
content: "";
|
|
|
|
display: table;
|
|
|
|
}
|
|
|
|
&:after {
|
|
|
|
clear: both;
|
|
|
|
}
|
2015-03-23 22:23:42 +08:00
|
|
|
}
|
|
|
|
|
2015-08-19 13:02:01 +08:00
|
|
|
//noinspection CssOptimizeSimilarProperties
|
2013-02-06 03:16:51 +08:00
|
|
|
@mixin linear-gradient($start-color, $end-color) {
|
|
|
|
background-color: $start-color;
|
|
|
|
background-image: linear-gradient(to bottom, $start-color, $end-color);
|
|
|
|
}
|
|
|
|
|
2023-05-23 05:03:34 +08:00
|
|
|
@mixin darken-background($background-color, $amt) {
|
|
|
|
$overlay: dark-light-choose(
|
|
|
|
rgba(var(--primary-rgb), $amt),
|
|
|
|
rgba(var(--secondary-rgb), $amt)
|
|
|
|
);
|
|
|
|
background-image: linear-gradient(to bottom, $overlay 100%, $overlay 100%);
|
|
|
|
}
|
|
|
|
|
2013-02-06 03:16:51 +08:00
|
|
|
// Visibility
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
2019-10-29 04:04:29 +08:00
|
|
|
// Only shows hover on non-touch devices
|
2013-02-06 03:16:51 +08:00
|
|
|
@mixin hover {
|
|
|
|
.discourse-no-touch & {
|
2019-10-29 04:04:29 +08:00
|
|
|
&:hover,
|
|
|
|
&.btn-hover {
|
2013-02-06 03:16:51 +08:00
|
|
|
@content;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-07 03:00:29 +08:00
|
|
|
@mixin ellipsis {
|
|
|
|
overflow: hidden;
|
|
|
|
white-space: nowrap;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
|
|
|
|
2020-02-15 05:19:11 +08:00
|
|
|
@mixin line-clamp($lines) {
|
|
|
|
display: -webkit-box;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
word-wrap: break-word;
|
|
|
|
-webkit-line-clamp: $lines;
|
2022-09-15 22:54:08 +08:00
|
|
|
-moz-box-orient: vertical;
|
2020-02-15 05:19:11 +08:00
|
|
|
-webkit-box-orient: vertical;
|
|
|
|
}
|
|
|
|
|
2013-04-09 05:43:52 +08:00
|
|
|
//
|
|
|
|
// --------------------------------------------------
|
|
|
|
|
2021-09-09 23:01:56 +08:00
|
|
|
$vpad: 0.5em;
|
|
|
|
$hpad: 0.65em;
|
|
|
|
|
|
|
|
// for consistent sizing across inputs, buttons and dropdowns
|
|
|
|
@mixin form-item-sizing {
|
|
|
|
border: 1px solid transparent;
|
|
|
|
font-size: var(--font-0);
|
|
|
|
line-height: normal;
|
|
|
|
box-sizing: border-box;
|
|
|
|
padding: $vpad $hpad;
|
2024-03-22 01:54:11 +08:00
|
|
|
.ios-device & {
|
|
|
|
font-size: var(--font-size-ios-input);
|
|
|
|
padding-top: $vpad * 0.8;
|
|
|
|
padding-bottom: $vpad * 0.8;
|
|
|
|
}
|
2021-09-09 23:01:56 +08:00
|
|
|
}
|
|
|
|
|
2020-10-20 05:26:38 +08:00
|
|
|
@mixin sticky {
|
|
|
|
position: -webkit-sticky;
|
|
|
|
position: sticky;
|
|
|
|
}
|
|
|
|
|
2014-12-23 18:52:20 +08:00
|
|
|
// Unselectable (avoids unwanted selections with iPad, touch laptops, etc)
|
2013-04-09 05:43:52 +08:00
|
|
|
|
2017-10-20 03:54:05 +08:00
|
|
|
@mixin user-select($mode) {
|
|
|
|
-webkit-user-select: $mode;
|
2020-09-21 19:32:46 +08:00
|
|
|
user-select: $mode;
|
2017-10-20 03:54:05 +08:00
|
|
|
}
|
|
|
|
|
2013-04-09 05:43:52 +08:00
|
|
|
@mixin unselectable {
|
2017-10-20 03:54:05 +08:00
|
|
|
@include user-select(none);
|
2022-09-15 21:56:45 +08:00
|
|
|
cursor: default;
|
2013-04-09 05:43:52 +08:00
|
|
|
}
|
2015-08-20 01:27:17 +08:00
|
|
|
|
|
|
|
// Stuff we repeat
|
|
|
|
@mixin post-aside {
|
2023-04-26 21:11:20 +08:00
|
|
|
border-left: 5px solid var(--primary-300);
|
2020-08-04 10:57:10 +08:00
|
|
|
background-color: var(--blend-primary-secondary-5);
|
2015-08-20 01:27:17 +08:00
|
|
|
}
|
2015-08-26 07:58:37 +08:00
|
|
|
|
2016-01-03 15:49:52 +08:00
|
|
|
// We still need -webkit for latest iPhone and Safari
|
2015-08-26 07:58:37 +08:00
|
|
|
@mixin transform($transforms) {
|
2018-06-08 17:49:31 +08:00
|
|
|
transform: $transforms;
|
2015-08-26 07:58:37 +08:00
|
|
|
}
|
2017-11-28 04:23:18 +08:00
|
|
|
|
2018-06-08 17:49:31 +08:00
|
|
|
@mixin appearance-none() {
|
|
|
|
// resets default browser styles
|
2017-11-28 04:23:18 +08:00
|
|
|
-webkit-appearance: none;
|
2018-06-08 17:49:31 +08:00
|
|
|
-moz-appearance: none;
|
|
|
|
appearance: none;
|
|
|
|
}
|
2018-11-27 05:49:57 +08:00
|
|
|
|
2021-02-04 00:45:54 +08:00
|
|
|
@mixin default-focus() {
|
|
|
|
border-color: var(--tertiary);
|
2023-11-29 02:44:45 +08:00
|
|
|
outline: 2px solid var(--tertiary);
|
2023-11-29 00:58:16 +08:00
|
|
|
outline-offset: -2px;
|
2021-02-04 00:45:54 +08:00
|
|
|
}
|
|
|
|
|
2018-11-27 05:49:57 +08:00
|
|
|
@mixin fa-rotate($degrees, $rotation) {
|
|
|
|
transform: rotate($degrees);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Helper function to easily use an SVG inline in CSS
|
|
|
|
/// without encoding it to base64, saving bytes.
|
|
|
|
/// It also helps with browser support, especially for IE11.
|
|
|
|
///
|
|
|
|
/// @author Jakob Eriksen
|
|
|
|
/// @link http://codepen.io/jakob-e/pen/doMoML
|
|
|
|
/// @param {String} $svg - SVG image to encode
|
|
|
|
/// @return {String} - Encoded SVG data uri
|
|
|
|
@function svg-uri($svg) {
|
|
|
|
$encoded: "";
|
|
|
|
$slice: 2000;
|
|
|
|
$index: 0;
|
2023-02-07 23:24:57 +08:00
|
|
|
$loops: ceil(math.div(str-length($svg), $slice));
|
2018-11-27 05:49:57 +08:00
|
|
|
|
|
|
|
@for $i from 1 through $loops {
|
|
|
|
$chunk: str-slice($svg, $index, $index + $slice - 1);
|
|
|
|
$chunk: str-replace($chunk, '"', "'");
|
|
|
|
$chunk: str-replace($chunk, "<", "%3C");
|
|
|
|
$chunk: str-replace($chunk, ">", "%3E");
|
|
|
|
$chunk: str-replace($chunk, "&", "%26");
|
|
|
|
$chunk: str-replace($chunk, "#", "%23");
|
|
|
|
$encoded: #{$encoded}#{$chunk};
|
|
|
|
$index: $index + $slice;
|
|
|
|
}
|
|
|
|
|
|
|
|
@return url("data:image/svg+xml;charset=utf8,#{$encoded}");
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Replace `$search` with `$replace` in `$string`
|
|
|
|
/// @author Hugo Giraudel
|
|
|
|
/// @link http://sassmeister.com/gist/1b4f2da5527830088e4d
|
|
|
|
/// @param {String} $string - Initial string
|
|
|
|
/// @param {String} $search - Substring to replace
|
|
|
|
/// @param {String} $replace ('') - New value
|
|
|
|
/// @return {String} - Updated string
|
|
|
|
@function str-replace($string, $search, $replace: "") {
|
|
|
|
$index: str-index($string, $search);
|
|
|
|
|
|
|
|
@if $index {
|
|
|
|
@return str-slice($string, 1, $index - 1) + $replace +
|
|
|
|
str-replace(
|
|
|
|
str-slice($string, $index + str-length($search)),
|
|
|
|
$search,
|
|
|
|
$replace
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@return $string;
|
|
|
|
}
|
2021-03-25 06:35:52 +08:00
|
|
|
|
|
|
|
// SCSS accepts HEX or RGB colors for rgba($color, 0.5)
|
|
|
|
// CSS custom properties only accept RGB
|
|
|
|
// Example usage:
|
|
|
|
|
|
|
|
// --primary-rgb: #{hexToRGB($primary)};
|
|
|
|
// ...
|
|
|
|
// rgba(var(--primary-low-rgb), 0.5)
|
|
|
|
|
|
|
|
@function hexToRGB($hex) {
|
|
|
|
@return red($hex), green($hex), blue($hex);
|
|
|
|
}
|
|
|
|
|
|
|
|
@function schemeType() {
|
|
|
|
@if is-light-color-scheme() {
|
|
|
|
@return "light";
|
|
|
|
} @else {
|
|
|
|
@return "dark";
|
|
|
|
}
|
|
|
|
}
|
2021-04-12 11:57:39 +08:00
|
|
|
|
|
|
|
@function absolute-image-url($path) {
|
|
|
|
// public_image_path is added by the stylesheet importer
|
|
|
|
// it returns a CDN or subfolder path (if applicable).
|
|
|
|
// SCSS will compile (and return the relative path) if public_image_path is missing.
|
|
|
|
@if variable-exists(public_image_path) {
|
2021-05-04 02:40:02 +08:00
|
|
|
@if (str-index("#{$path}", "/plugins") == 1) {
|
|
|
|
$plugin_asset_path: str-replace($public_image_path, "/images", "");
|
|
|
|
@return url("#{$plugin_asset_path}#{$path}");
|
|
|
|
} @else {
|
|
|
|
@return url("#{$public_image_path}#{$path}");
|
|
|
|
}
|
2021-04-12 11:57:39 +08:00
|
|
|
} @else {
|
|
|
|
@return url("#{$path}");
|
|
|
|
}
|
|
|
|
}
|
FEATURE: Generic hashtag autocomplete lookup and markdown cooking (#18937)
This commit fleshes out and adds functionality for the new `#hashtag` search and
lookup system, still hidden behind the `enable_experimental_hashtag_autocomplete`
feature flag.
**Serverside**
We have two plugin API registration methods that are used to define data sources
(`register_hashtag_data_source`) and hashtag result type priorities depending on
the context (`register_hashtag_type_in_context`). Reading the comments in plugin.rb
should make it clear what these are doing. Reading the `HashtagAutocompleteService`
in full will likely help a lot as well.
Each data source is responsible for providing its own **lookup** and **search**
method that returns hashtag results based on the arguments provided. For example,
the category hashtag data source has to take into account parent categories and
how they relate, and each data source has to define their own icon to use for the
hashtag, and so on.
The `Site` serializer has two new attributes that source data from `HashtagAutocompleteService`.
There is `hashtag_icons` that is just a simple array of all the different icons that
can be used for allowlisting in our markdown pipeline, and there is `hashtag_context_configurations`
that is used to store the type priority orders for each registered context.
When sending emails, we cannot render the SVG icons for hashtags, so
we need to change the HTML hashtags to the normal `#hashtag` text.
**Markdown**
The `hashtag-autocomplete.js` file is where I have added the new `hashtag-autocomplete`
markdown rule, and like all of our rules this is used to cook the raw text on both the clientside
and on the serverside using MiniRacer. Only on the server side do we actually reach out to
the database with the `hashtagLookup` function, on the clientside we just render a plainer
version of the hashtag HTML. Only in the composer preview do we do further lookups based
on this.
This rule is the first one (that I can find) that uses the `currentUser` based on a passed
in `user_id` for guardian checks in markdown rendering code. This is the `last_editor_id`
for both the post and chat message. In some cases we need to cook without a user present,
so the `Discourse.system_user` is used in this case.
**Chat Channels**
This also contains the changes required for chat so that chat channels can be used
as a data source for hashtag searches and lookups. This data source will only be
used when `enable_experimental_hashtag_autocomplete` is `true`, so we don't have
to worry about channel results suddenly turning up.
------
**Known Rough Edges**
- Onebox excerpts will not render the icon svg/use tags, I plan to address that in a follow up PR
- Selecting a hashtag + pressing the Quote button will result in weird behaviour, I plan to address that in a follow up PR
- Mixed hashtag contexts for hashtags without a type suffix will not work correctly, e.g. #ux which is both a category and a channel slug will resolve to a category when used inside a post or within a [chat] transcript in that post. Users can get around this manually by adding the correct suffix, for example ::channel. We may get to this at some point in future
- Icons will not show for the hashtags in emails since SVG support is so terrible in email (this is not likely to be resolved, but still noting for posterity)
- Additional refinements and review fixes wil
2022-11-21 06:37:06 +08:00
|
|
|
|
|
|
|
@mixin mention() {
|
2024-03-25 16:55:29 +08:00
|
|
|
display: inline;
|
FEATURE: Generic hashtag autocomplete lookup and markdown cooking (#18937)
This commit fleshes out and adds functionality for the new `#hashtag` search and
lookup system, still hidden behind the `enable_experimental_hashtag_autocomplete`
feature flag.
**Serverside**
We have two plugin API registration methods that are used to define data sources
(`register_hashtag_data_source`) and hashtag result type priorities depending on
the context (`register_hashtag_type_in_context`). Reading the comments in plugin.rb
should make it clear what these are doing. Reading the `HashtagAutocompleteService`
in full will likely help a lot as well.
Each data source is responsible for providing its own **lookup** and **search**
method that returns hashtag results based on the arguments provided. For example,
the category hashtag data source has to take into account parent categories and
how they relate, and each data source has to define their own icon to use for the
hashtag, and so on.
The `Site` serializer has two new attributes that source data from `HashtagAutocompleteService`.
There is `hashtag_icons` that is just a simple array of all the different icons that
can be used for allowlisting in our markdown pipeline, and there is `hashtag_context_configurations`
that is used to store the type priority orders for each registered context.
When sending emails, we cannot render the SVG icons for hashtags, so
we need to change the HTML hashtags to the normal `#hashtag` text.
**Markdown**
The `hashtag-autocomplete.js` file is where I have added the new `hashtag-autocomplete`
markdown rule, and like all of our rules this is used to cook the raw text on both the clientside
and on the serverside using MiniRacer. Only on the server side do we actually reach out to
the database with the `hashtagLookup` function, on the clientside we just render a plainer
version of the hashtag HTML. Only in the composer preview do we do further lookups based
on this.
This rule is the first one (that I can find) that uses the `currentUser` based on a passed
in `user_id` for guardian checks in markdown rendering code. This is the `last_editor_id`
for both the post and chat message. In some cases we need to cook without a user present,
so the `Discourse.system_user` is used in this case.
**Chat Channels**
This also contains the changes required for chat so that chat channels can be used
as a data source for hashtag searches and lookups. This data source will only be
used when `enable_experimental_hashtag_autocomplete` is `true`, so we don't have
to worry about channel results suddenly turning up.
------
**Known Rough Edges**
- Onebox excerpts will not render the icon svg/use tags, I plan to address that in a follow up PR
- Selecting a hashtag + pressing the Quote button will result in weird behaviour, I plan to address that in a follow up PR
- Mixed hashtag contexts for hashtags without a type suffix will not work correctly, e.g. #ux which is both a category and a channel slug will resolve to a category when used inside a post or within a [chat] transcript in that post. Users can get around this manually by adding the correct suffix, for example ::channel. We may get to this at some point in future
- Icons will not show for the hashtags in emails since SVG support is so terrible in email (this is not likely to be resolved, but still noting for posterity)
- Additional refinements and review fixes wil
2022-11-21 06:37:06 +08:00
|
|
|
font-size: 0.93em;
|
2022-11-24 06:35:57 +08:00
|
|
|
font-weight: normal;
|
2022-11-23 07:17:03 +08:00
|
|
|
color: var(--primary);
|
2024-04-06 04:23:37 +08:00
|
|
|
padding: 0.14em 0.34em 0.19em;
|
FEATURE: Generic hashtag autocomplete lookup and markdown cooking (#18937)
This commit fleshes out and adds functionality for the new `#hashtag` search and
lookup system, still hidden behind the `enable_experimental_hashtag_autocomplete`
feature flag.
**Serverside**
We have two plugin API registration methods that are used to define data sources
(`register_hashtag_data_source`) and hashtag result type priorities depending on
the context (`register_hashtag_type_in_context`). Reading the comments in plugin.rb
should make it clear what these are doing. Reading the `HashtagAutocompleteService`
in full will likely help a lot as well.
Each data source is responsible for providing its own **lookup** and **search**
method that returns hashtag results based on the arguments provided. For example,
the category hashtag data source has to take into account parent categories and
how they relate, and each data source has to define their own icon to use for the
hashtag, and so on.
The `Site` serializer has two new attributes that source data from `HashtagAutocompleteService`.
There is `hashtag_icons` that is just a simple array of all the different icons that
can be used for allowlisting in our markdown pipeline, and there is `hashtag_context_configurations`
that is used to store the type priority orders for each registered context.
When sending emails, we cannot render the SVG icons for hashtags, so
we need to change the HTML hashtags to the normal `#hashtag` text.
**Markdown**
The `hashtag-autocomplete.js` file is where I have added the new `hashtag-autocomplete`
markdown rule, and like all of our rules this is used to cook the raw text on both the clientside
and on the serverside using MiniRacer. Only on the server side do we actually reach out to
the database with the `hashtagLookup` function, on the clientside we just render a plainer
version of the hashtag HTML. Only in the composer preview do we do further lookups based
on this.
This rule is the first one (that I can find) that uses the `currentUser` based on a passed
in `user_id` for guardian checks in markdown rendering code. This is the `last_editor_id`
for both the post and chat message. In some cases we need to cook without a user present,
so the `Discourse.system_user` is used in this case.
**Chat Channels**
This also contains the changes required for chat so that chat channels can be used
as a data source for hashtag searches and lookups. This data source will only be
used when `enable_experimental_hashtag_autocomplete` is `true`, so we don't have
to worry about channel results suddenly turning up.
------
**Known Rough Edges**
- Onebox excerpts will not render the icon svg/use tags, I plan to address that in a follow up PR
- Selecting a hashtag + pressing the Quote button will result in weird behaviour, I plan to address that in a follow up PR
- Mixed hashtag contexts for hashtags without a type suffix will not work correctly, e.g. #ux which is both a category and a channel slug will resolve to a category when used inside a post or within a [chat] transcript in that post. Users can get around this manually by adding the correct suffix, for example ::channel. We may get to this at some point in future
- Icons will not show for the hashtags in emails since SVG support is so terrible in email (this is not likely to be resolved, but still noting for posterity)
- Additional refinements and review fixes wil
2022-11-21 06:37:06 +08:00
|
|
|
background: var(--primary-low);
|
2022-11-24 06:35:57 +08:00
|
|
|
border-radius: 0.6em;
|
|
|
|
text-decoration: none;
|
2024-03-25 16:55:29 +08:00
|
|
|
text-wrap: nowrap;
|
2024-08-20 20:37:28 +08:00
|
|
|
|
|
|
|
&.--bot {
|
2024-08-21 23:45:48 +08:00
|
|
|
background: var(--success-low);
|
2024-08-20 20:37:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
&.--wide {
|
2024-08-21 23:45:48 +08:00
|
|
|
background: var(--highlight-low-or-medium);
|
2024-08-20 20:37:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
&.--current {
|
2024-08-21 23:45:48 +08:00
|
|
|
background: var(--tertiary-400);
|
2024-08-20 20:37:28 +08:00
|
|
|
}
|
FEATURE: Generic hashtag autocomplete lookup and markdown cooking (#18937)
This commit fleshes out and adds functionality for the new `#hashtag` search and
lookup system, still hidden behind the `enable_experimental_hashtag_autocomplete`
feature flag.
**Serverside**
We have two plugin API registration methods that are used to define data sources
(`register_hashtag_data_source`) and hashtag result type priorities depending on
the context (`register_hashtag_type_in_context`). Reading the comments in plugin.rb
should make it clear what these are doing. Reading the `HashtagAutocompleteService`
in full will likely help a lot as well.
Each data source is responsible for providing its own **lookup** and **search**
method that returns hashtag results based on the arguments provided. For example,
the category hashtag data source has to take into account parent categories and
how they relate, and each data source has to define their own icon to use for the
hashtag, and so on.
The `Site` serializer has two new attributes that source data from `HashtagAutocompleteService`.
There is `hashtag_icons` that is just a simple array of all the different icons that
can be used for allowlisting in our markdown pipeline, and there is `hashtag_context_configurations`
that is used to store the type priority orders for each registered context.
When sending emails, we cannot render the SVG icons for hashtags, so
we need to change the HTML hashtags to the normal `#hashtag` text.
**Markdown**
The `hashtag-autocomplete.js` file is where I have added the new `hashtag-autocomplete`
markdown rule, and like all of our rules this is used to cook the raw text on both the clientside
and on the serverside using MiniRacer. Only on the server side do we actually reach out to
the database with the `hashtagLookup` function, on the clientside we just render a plainer
version of the hashtag HTML. Only in the composer preview do we do further lookups based
on this.
This rule is the first one (that I can find) that uses the `currentUser` based on a passed
in `user_id` for guardian checks in markdown rendering code. This is the `last_editor_id`
for both the post and chat message. In some cases we need to cook without a user present,
so the `Discourse.system_user` is used in this case.
**Chat Channels**
This also contains the changes required for chat so that chat channels can be used
as a data source for hashtag searches and lookups. This data source will only be
used when `enable_experimental_hashtag_autocomplete` is `true`, so we don't have
to worry about channel results suddenly turning up.
------
**Known Rough Edges**
- Onebox excerpts will not render the icon svg/use tags, I plan to address that in a follow up PR
- Selecting a hashtag + pressing the Quote button will result in weird behaviour, I plan to address that in a follow up PR
- Mixed hashtag contexts for hashtags without a type suffix will not work correctly, e.g. #ux which is both a category and a channel slug will resolve to a category when used inside a post or within a [chat] transcript in that post. Users can get around this manually by adding the correct suffix, for example ::channel. We may get to this at some point in future
- Icons will not show for the hashtags in emails since SVG support is so terrible in email (this is not likely to be resolved, but still noting for posterity)
- Additional refinements and review fixes wil
2022-11-21 06:37:06 +08:00
|
|
|
}
|
2024-06-24 21:54:34 +08:00
|
|
|
|
|
|
|
@mixin nav-active() {
|
|
|
|
color: var(--d-nav-color--active);
|
|
|
|
background: var(--d-nav-bg-color--active);
|
|
|
|
.d-icon {
|
|
|
|
color: var(--d-nav-color--active);
|
|
|
|
}
|
|
|
|
&:after {
|
|
|
|
content: "";
|
|
|
|
position: absolute;
|
|
|
|
left: 0;
|
|
|
|
bottom: 0;
|
|
|
|
right: 0;
|
|
|
|
height: var(--d-nav-underline-height);
|
|
|
|
background: var(--d-nav-color--active);
|
|
|
|
}
|
|
|
|
}
|
2024-11-01 03:44:08 +08:00
|
|
|
|
|
|
|
@mixin click-counter-badge {
|
|
|
|
content: attr(data-clicks);
|
|
|
|
font-weight: normal;
|
|
|
|
background-color: var(--primary-low);
|
|
|
|
color: var(--primary-medium);
|
|
|
|
position: relative;
|
|
|
|
top: -1px;
|
|
|
|
padding: 0.21em 0.42em;
|
|
|
|
min-width: 0.5em;
|
|
|
|
line-height: var(--line-height-small);
|
|
|
|
font-size: var(--font-down-2);
|
|
|
|
text-align: center;
|
|
|
|
border-radius: 10px;
|
|
|
|
white-space: nowrap;
|
|
|
|
display: inline-block;
|
|
|
|
margin: 0.15em;
|
|
|
|
}
|