Comments (3)
The solution delivered in Feb 2016 only supports links where the fragment is just part of the link
e.g. [bw_link example.com/page#fragment]
or [bw_link example.com/page/#fragment]
and not where it's intended to be a link to somewhere else on the page
e.g. [bw_link #fragment]
.
The current implementation on some sites appears a bit flaky, with scrolling to the selected ID only working on a tablet. This observation needs verifying.
The solution should support at least some of the techniques documented in https://en.m.wikipedia.org/wiki/Fragment_identifier
from oik.
The code's been updated to provide better support when linking to a specified domain and when using #fragment on its own.
Tests have been implemented for both without fragments - see below - and with.
bw_link 0th parameter | Expected to produce | Implemented? |
---|---|---|
|
empty link | Yes |
/ | Link to $domain | Yes |
/somewhere | Link to $domain/somwehere | Yes |
/somewhere/child | Link to $domain/somewhere/child | Yes |
example.com | Link to example.com | Yes |
example.com/path | Link to example.com/path | Yes |
http://example.com |
Link as given | Yes |
https://example.com |
Link as given | Yes |
18356 | Link to post 18356 | Yes |
post_type | Link to the Post type archive | ? |
archive | Link to any other archive? | ? |
s://p | Multisite link s is site ID and p is post ID | No |
Notes:
- When we link to somewhere in the current domain we don't check that the permalink exists
- We no longer support links to child pages
- $domain may not include the scheme... as it's stripped in bw_get_domain
from oik.
It would also be nice to be able to automatically generate nice link text and title when using #fragment
.
to support something like this.
[bw_link "#This fragment"]
[bw_link "#That fragment"]
...
[div id="This fragment"]
<h3>This fragment</h3>
[ediv]
[div id="That fragment"]
<h3>That fragment</h3>
[ediv]
from oik.
Related Issues (20)
- oik/address block - wrong description in block.json HOT 1
- Add support for lazy loading images `loading="lazy"` HOT 2
- Change bw_follow_me to support `font=svg` to replace `font=dashicons` or `font=genericons` HOT 7
- Google Maps block doesn't work in blocks.wp-a2z.org HOT 4
- bw_table excerpt field processing doesn't render blocks HOT 1
- Unexpected JavaScript shown in snippet for the [bw_power] shortcode
- [bw_wpadmin] not wrapped in any div/span tag so gets flowed inline
- wp-pompey.org.uk - Fatal error: Uncaught Error: Class 'OIK_SVG_icons' not found HOT 2
- oik/shortcodes block - SelectControl is enormous HOT 3
- Shortcodes not expanded in `term_description` HOT 5
- Default `show_in_nav_menus` to false if not set HOT 1
- Warning on oik options > plugins Add new HOT 1
- bw_get_posts() - Add support for post_name attr HOT 2
- [bw_pages] - dynamic blocks not being rendered HOT 1
- Update to the latest @wordpress/scripts package and rework as required HOT 5
- Warning: Invalid DOM property `fill-rule`. Did you mean `fillRule` ? HOT 2
- Contact form: add additional fields such as telephone HOT 25
- Blocks not registered in oik downloaded from WordPress.org HOT 1
- Memory exhausted while running PHPUnit tests for oik on s.b/wordpress HOT 1
- Consider making [bw_accordion] front end more accessible HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oik.