GithubHelp home page GithubHelp logo

Comments (6)

user178392143 avatar user178392143 commented on September 14, 2024

My bad; I closed this by mistake. It's still an issue. (The Close button is next to the window for adding a new comment so I thought it would close that, not close my issue!)

from tyto.

jh3y avatar jh3y commented on September 14, 2024

Hey @edemond-clarity ,

Have only just seen this. Will have to have a look when I get a minute. I can only imagine, it's some kind of encoding issue that needs a piece of regex to pick up on #. Because # wouldn't invalidate the json.

Seems a little strange.

Thanks for issuing ;)

from tyto.

jh3y avatar jh3y commented on September 14, 2024

Right so had a quick look at this and actually thinking about this it kinda makes sense now.

The way in which the export works is by clicking an invisible anchor tag with the href set to the json content.

Because # is a special character in the href property of an anchor tag, that's why it's cutting off the content. The json being generated is fine but what will have to be done is I'll have to actually write a replace encoding of my own just for the # character.

So I think when export I'll do something like replace with @tyto-hash and then when importing, just change that back out to #.

@jh3y

from tyto.

jh3y avatar jh3y commented on September 14, 2024

So I spent a few moments and fixed this up for you.

I've added in an object that manages escapes and their used defined equivalents.

tyto.prototype._escapes = {
    "#": "@tyto-hash"
}

Then before exporting and importing a new function is run that will encode or decode the string approriately with those user defined escapes.

tyto.prototype._decodeJSON = function(jsonString) {
    var escape, regex;
    tyto = this;
    if (jsonString !== undefined) {
        for (escape in tyto._escapes) {
            regex = new RegExp(tyto._escapes[escape], 'g');
            jsonString = jsonString.replace(regex, escape);
        }
    }
    return jsonString;
}; 

This seems to fix it. I'll upload to the pages branch too.

Thanks for raising this!

@jh3y

from tyto.

user178392143 avatar user178392143 commented on September 14, 2024

Thanks, appreciate you looking into it -- works great!

from tyto.

jh3y avatar jh3y commented on September 14, 2024

No problem, anytime.

The solution should be pretty reliable and can use the mechanics of it for some of the future features hopefully.

@jh3y

from tyto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.