请问一下 自定义节点导出功能无法显示节点只有线怎么处理 谢谢!

This issue has been created since 2021-12-15.

097494b426c238078bea66c1525e439
ab4928aa40e6d0e904faae87639177b

towersxu wrote this answer on 2021-12-15

logicflow的导出是将画布中svg的内容转换到canvas导出,当页面节点的外观用class控制的时候,这个时候没有拿到样式。对应需要导出图片的场景,建议将css采用inline-style来实现。如果是自定义html,可以再渲染html的时候将css统一放到style标签中(这样会出现多个内容相同的style标签)。

  setHtml(rootEl: HTMLElement) {
    const { properties } = this.getAttributes();
    if (!this.shouldUpdate()) return;
  
    const el = document.createElement('div');
    el.className = 'uml-wrapper';
    const html = `
      <div>
        <div class="uml-head">Head</div>
        <div style="width: 200px;height: 100px">
          <div>+ ${properties.name}</div>
          <div>+ ${properties.body}</div>
        </div>
      </div>
    `
    el.innerHTML = html;

    const style = document.createElement('style')
    // 如果html节点希望导出,需要将html节点的样式也放到节点里面。
    style.innerHTML = `
    .uml-head{
      font-size: 14px
    }  
    `
    el.appendChild(style);
    // 需要先把之前渲染的子节点清除掉。
    rootEl.innerHTML = '';
    rootEl.appendChild(el);
  }
towersxu wrote this answer on 2021-12-16

后续版本考虑增加在调用导出插件的时候,支持传入style或者自动获取当前页面所有的样式。

More Details About Repo
Owner Name didi
Repo Name LogicFlow
Full Name didi/LogicFlow
Language TypeScript
Created Date 2020-12-24
Updated Date 2022-09-27
Star Count 2867
Watcher Count 47
Fork Count 489
Issue Count 70

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Disable physical touchpad buttons 0 2021-12-15 2022-09-04
Usage of Multiple GPUs causes Error in State Dict 1 2021-08-15 2022-08-05
LuLu doesn't like ZeroTier 1 2022-01-16 2022-09-11
launch.json reports that '"request": "test",' is invalid, wants "attach" instead. 2 2022-04-07 2022-09-10
Bug: 'serverpod run' throwing errors related to 'serverpod_postgres_pool' package 1 2022-09-11 2022-09-20
Add comparisons to ColumnSerializable (enum) 0 2022-09-09 2022-09-20
Additional functionality for downloading seasons 0 2022-03-17 2022-08-27
[BUG/ISSUE] Model crashing when species missing from restart file 7 2022-04-26 2022-09-04
[Idea] Disable SponsorBlock features while adding a segment 0 2022-01-21 2022-03-03
[BUG] Cant rename account or load user ID 1 2021-10-26 2022-03-03
Skipped Segment Count doesn't sync with Desktop 1 2021-11-03 2022-03-03
Skip Segment button stays when switching videos. 0 2021-12-07 2022-03-03
Cleanup HDF5 ifdef logic for restart interfaces 0 2022-01-26 2022-09-16
[Bug] unable to find user deno: no matching entries in passwd file 6 2021-07-23 2022-09-08
JEI taking forever to load "Indexing Ingredients" 2 2021-11-13 2022-09-02
Wrong returned type of autogl.datasets.utils.conversion.general_static_graphs_to_pyg_dataset 1 2021-12-17 2022-09-13
Feature : ECHO utility to support hex output 6 2021-01-04 2022-08-09
[Split Checkout] Order confirmation URL does not contain order_token 0 2022-04-29 2022-07-25
External drag end drop 1 2021-11-16 2022-08-29
wtf is this function 4 2022-01-13 2022-09-19
'This site can’t be reached' outside vm 11 2022-02-21 2022-09-24
`complete(fill)` should accept single value 2 2022-04-13 2022-09-13
Questions about whether can RepeatMasker find tandem repeats 0 2022-09-11 2022-09-16
The meaning of milliDiv 0 2022-09-12 2022-09-08
Test tree does not emit entry for `with-test` and `defspec` vars 3 2022-01-12 2022-09-06
conda update conda cannot update conda 8 2021-12-06 2022-09-04
A potential error due to the unreleased lock 6 2021-09-01 2022-08-26
Segfault after some time playing 0 2022-07-27 2022-09-11
The manpage has >1200 lines! 3 2022-07-27 2022-09-11
Support --allow-missing-config for pre-commit autoupdate 1 2021-10-07 2022-09-18
conformance tests should not depend on the contents of the 'location' field in Files, Directories 0 2021-10-05 2022-09-06
Questions about the result json file in coco format 1 2021-12-26 2022-07-24
F36: CHANGE: Retired Packages 3 2022-02-09 2022-09-10
Asset metadata format 3 2021-05-10 2022-09-05
Reusing soundId 0 for audios/Lama Tanz.mp3 is loading=true [email protected] 2 2021-09-05 2022-09-13
Rename imports ? 1 2022-01-13 2022-01-07
Unable to use custom TemplateFactory with LatteExtension since 3.1 0 2021-05-19 2022-09-04
Refactor bootstrap documentation URLs to /latest/ (when available) 1 2021-11-12 2022-03-14
Warning by linter on assert in test_render_messages.py 2 2021-11-10 2022-08-23
Ansible collection upload URL missing /pulp/api/v3/ 0 2021-11-17 2022-08-16
Full text search trigger is not executed on insert 0 2021-11-17 2021-12-22
Support Wire ()code generation 2 2022-02-21 2022-09-25
leafletProxy not working 2 2021-11-24 2022-09-05
Nightly build failed for ipfs-cluster-ctl 1 2021-12-27 2022-09-01
Add generic plugin hook for configuration 2 2022-08-08 2022-09-02
LWG-3530 `BUILTIN-PTR-MEOW` should not opt the type out of syntactic checks 1 2021-09-02 2022-08-17
ValueError: axes don't match array, images will work one run and not work the next 0 2022-04-16 2022-09-16
How to show real and fake loss in Colab? 0 2022-07-26 2022-09-16
[Bug]: Properties of Error subclasses other than `message` are ignored when using `toEqual`. 2 2022-09-09 2022-09-19
Bug: React 18 types broken since the type release a view hours ago 47 2022-04-08 2022-09-16