Change Title Text #25

Open
opened 2017-10-23 21:13:57 -07:00 by bibbca · 1 comment
bibbca commented 2017-10-23 21:13:57 -07:00 (Migrated from github.com)

I would love functionality to be able to change the text so when I export to pdf I could have the actual title in the upper left corner.

I would love functionality to be able to change the <title>Writing</title> text so when I export to pdf I could have the actual title in the upper left corner.
tsoldaat commented 2018-02-19 04:20:25 -08:00 (Migrated from github.com)

I mostly write small reports and such with Writing and consider the text of the first <h1> to be the document title. So I added setting the title to the print-routine, like so:

if (e.keyCode == 80 && e.ctrlKey) {    // CTRL + P 
    if (mode != 1) {
        mode = 1;
        $('#wmd-input').hide();
        $('#wmd-preview').show();
        $('body').removeClass('fixedheight');
        $('html').removeClass('fixedheight');
        firstH1 = $('#wmd-preview').find('h1').text(); // Get content of first H1
        $('title').html(firstH1);                      // Set title using firstH1
        e.preventDefault();
        window.print();
        return false;
    }
[...]

HTH

I mostly write small reports and such with Writing and consider the text of the first `<h1>` to be the document title. So I added setting the title to the print-routine, like so: ```javascript if (e.keyCode == 80 && e.ctrlKey) { // CTRL + P if (mode != 1) { mode = 1; $('#wmd-input').hide(); $('#wmd-preview').show(); $('body').removeClass('fixedheight'); $('html').removeClass('fixedheight'); firstH1 = $('#wmd-preview').find('h1').text(); // Get content of first H1 $('title').html(firstH1); // Set title using firstH1 e.preventDefault(); window.print(); return false; } [...] ``` HTH
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
brad/writing#25
No description provided.