klembot / twinejs

Twine, a tool for telling interactive, nonlinear stories
https://twinery.org
GNU General Public License v3.0
1.95k stars 293 forks source link

enable/disable passage link-connectors for better performance and clear view #1451

Open flarack opened 1 year ago

flarack commented 1 year ago

Is your feature request related to a problem? Please describe.

The acutal story I'm working on uses chapbook and references a global header and footer in every passage. Due to automated generation of visible passage link-connectors in the ui, the performance is getting worse with each passage to be added. automated_passage_links

Describe the solution you'd like.

A simple solution is to add options in the settings panel to make passage link-connectors visible / invisible. Maybe even two options for:

  1. show embedded passage link-connectors [yes/no]
  2. show direct passage link-connectors [yes/no]

Describe alternatives you've considered.

Atm I delete the class="link-connectors" each time I open twine, but it's a clunky workaround. Maybe there is a solution using the user.css from twine 2.70, but I don't know how.

Additional context on this suggestion.

No response

Presubmission checklist

greyelf commented 1 year ago

@flarack Could you supply an example of the code you are using currently in each of those Passages to reference the "Global" related header & footer Passages?

flarack commented 1 year ago

@greyelf It is a simple embed:

{embed passage: 'global.header'} {embed passage: 'global.footer'}

header_footer_embed

The header is mainly used as minimal interface, the footer as "menu"

greyelf commented 1 year ago

@flarack After reviewing the relevant sections of the both the Twine 2.x application's code, and that of Chapbook's Passage Editor Extension, responsible for locating "links" within a Passage's content so a related Connector Arrow can be shown, it appears that the "broken line" based connectors you mention are being generated by the Extension and not by the Twine 2.x application itself.

If this is the case then you may need to report this performance related issue on Chapbook's repository so its Developer can;

klembot commented 1 year ago

A couple possible workarounds:

  1. Disable editor extensions for Chapbook
  2. Add the following to user.css:
.story-edit-route .link-connectors {
  display: none;
}
flarack commented 1 year ago

@klembot @greyelf Thanks a lot for your investigation. Disabling editor extensions is a near perfect solution to this issue.

hituro commented 11 months ago

@klembot @greyelf Thanks a lot for your investigation. Disabling editor extensions is a near perfect solution to this issue.

But then you get no syntax highlighting inside the passage. I'd think the CSS route would be better.

Another option would be to add your own custom insert which is just a copy of embed with a different name, so that it won't create arrows, e.g.

engine.extend('1.0.0', () => {
    config.template.inserts = [{
        match: /^silent-embed\s+passage(\s+named)?/i,
        render(passage) {
            return mainRender(passageNamed(passage).source);
        }
    }, ...config.template.inserts];
});