Skip to content
This repository has been archived by the owner on Jun 29, 2019. It is now read-only.

Handle title text overflow nicely? #131

Open
notatestuser opened this issue May 3, 2016 · 20 comments
Open

Handle title text overflow nicely? #131

notatestuser opened this issue May 3, 2016 · 20 comments

Comments

@notatestuser
Copy link
Contributor

notatestuser commented May 3, 2016

A list item's description text uses text-overflow: ellipsis to clip overflow nicely when the content is longer than its allotted space. However, titles can clip off long words or wrap to new lines when they are long and contain spaces. This can look a bit funky in some places.

Proposal: Add a new attribute in SearchResult to apply text-overflow: ellipsis* on the title text. We would only want to do this optionally per plugin and not in all of them. It's still useful to wrap titles when calculating a long formula in hain-plugin-math, for instance.

res.add({
    // ...
    title: longTitle,
    singleLineTitle: true,  // <- applies text-overflow property to the title
    // ...
})

Example of long word clip:

Example of multi-line break:

* The actual styles we need to apply are something like:

text-overflow: ellipsis;
white-space: nowrap;
overflow-x: hidden;

I've experimented with this locally and it seems to work fine:

hainclippedtitle

What do you think?

@appetizermonster
Copy link
Collaborator

Nice proposal, and I think it must be supported, but additional property for SearchResult isn't that nice.
I think we can find some better way.

@notatestuser
Copy link
Contributor Author

OK. Do you think it could be at the plugin level?

@appetizermonster
Copy link
Collaborator

Maybe, but I have no confidence about it.
How do you think about the below one?

res.add({
  title: {   // can be String or Object
    text: 'single line text',
    singleLine: true
  },
  ...
});

@notatestuser
Copy link
Contributor Author

That looks fine to me.

@appetizermonster
Copy link
Collaborator

Resolved at 84be796, needs docs

@notatestuser
Copy link
Contributor Author

I had forgot to mention that my only concern is that the object form of the title is no longer backward compatible with previous versions. To work around this we could use a new name for the object form and continue to use a string title for older releases. What do you think?

@appetizermonster
Copy link
Collaborator

Oh, you don't need to worry about it. I wrote a code to support both string and object. so it has backward compatibility. no need to workaround.

@notatestuser
Copy link
Contributor Author

I see. And a new plugin in an older hain will not produce problems either?

@appetizermonster
Copy link
Collaborator

No, Sorry, I misunderstood. new plugin with new API will not be listed in older hain if they write new API version in package.json or they can handle it by using appContext.CURRENT_API_VERSION.

@notatestuser
Copy link
Contributor Author

That's great - thanks.

@notatestuser
Copy link
Contributor Author

The titles appear to hit the text-util as strings of [object Object]. Is react stringifying them?

@notatestuser
Copy link
Contributor Author

Bump @appetizermonster 😉

@appetizermonster
Copy link
Collaborator

@notatestuser Oh sorry, I'll make a patch for it soon.

@notatestuser
Copy link
Contributor Author

Thanks!

Get Outlook for iOS

On Thu, Jun 16, 2016 at 10:53 AM +0800, "Heejin Lee" notifications@github.com wrote:

@notatestuser Oh sorry, I'll make a patch for it soon.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@appetizermonster
Copy link
Collaborator

Resolved at 202287c

@notatestuser
Copy link
Contributor Author

Great! Please bump up the API version in the next release so I can target this fix. Thanks. 😄

@appetizermonster
Copy link
Collaborator

Okay, I'll

@notatestuser
Copy link
Contributor Author

notatestuser commented Jul 4, 2016

Hey, do you have any idea when this will be released?

@appetizermonster
Copy link
Collaborator

@notatestuser Sorry for late, I'm so busy for my work these days, I think it will be released with several another additions in at least two weeks.

@notatestuser
Copy link
Contributor Author

Bump. I would really like to see this fixed. 😃

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants