Git Product home page Git Product logo

Comments (5)

mrsweaters avatar mrsweaters commented on August 27, 2024

Can you try <h3 contenteditable="false">Text</h3>? I think that should do the trick.

from tribute.

ismailhakkieren avatar ismailhakkieren commented on August 27, 2024

i tried but i cant write anything. i need contenteditable="true". ithink i should change tribute.js when i see #hContent id i'll return nothing.

from tribute.

ismailhakkieren avatar ismailhakkieren commented on August 27, 2024
$("#mainEditor").keyup(function () {
    var focusNode = window.getSelection().focusNode;
    var idFocus = "";
    var parentNode = focusNode.parentNode;
    idFocus = parentNode.id;
    if (idFocus == "hContent") {
        console.log("not here");
    } else {
        tribute.attach($('#mainEditor'));
    }
});

i wrote this code and mentions doesnt work in #hContent h3. it is ok for me. But when i mentions other element in #mainEditor div.
console error : tribute.js:230 Uncaught TypeError: Cannot read property '0' of undefined
line is : let item = this.current.filteredItems[index]

how i can do it. Please help me

from tribute.

mrsweaters avatar mrsweaters commented on August 27, 2024

This doesn't help me get a picture of what you are trying to do. It would be best if you could create a plunkr or jsfiddle that has both the markup and the JS you are using.

However, it does seem that #mainEditor is the parent of the h3. This seems wrong to me as you don't want your user to be able to mention in that content.

I would do this:

<div id="mainEditor">
    <h3>Title</h3>
    <div class="content">
        Editable content.
    </div>
</div>

For the js:

tribute.attach($('#mainEditor').find('.content'))

Then you would make the h3 and the div.content section independently editable. Also store these as two separate attributes in your database. You can then style #mainContent so that the h3 and the div.content section look as if they are part of the same editable area. I hope that makes sense.

from tribute.

mrsweaters avatar mrsweaters commented on August 27, 2024

I'm going to close this issue since I feel like the above is the best route for you to take.

from tribute.

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.